BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hari1109
Fluorite | Level 6

Hi All,

Thanks in advance, I have been trying to connect to a database on MSSQL server and i am facing trouble with the libname statement that i have to use. I have the user name and password to access the server but i am not able to run the libname statement.

i am using the following libname statement.

libname mssql  user =  password =   database =    server =    schema =  ;

i am receiving that the libname statement is not assigned.

Thank you,

Harish.


1 ACCEPTED SOLUTION

Accepted Solutions
FriedEgg
SAS Employee

Are you licensed for the SAS/ACCESS interface for the database type you are trying to connect to?

Do you know what type of database you are connecting to?

Can you access the database by other means on the same machine you are trying to connect to it with SAS?

It sounds to me like you should contact your companies SAS Admin staff or technical support.

Try running the libname statement again with the following before the libname statement.  Copy and paste your log here:

options msglevel=i sastrace=',,t,ds' sastraceloc=saslog;

libname etc mysql user= pass= database= server= port=;

View solution in original post

5 REPLIES 5
FriedEgg
SAS Employee

If MSSQL means MySQL:

libname mylib mysql user=user password=password database=mysqldb server=mysqlservr port=9876;

If MSSQL means Microsoft SQL Server then you need to use the sqlsrv engine:

libname mylib sqlsvr nopromt="uid=user; pwd=pass; dsn=sqlservr;";

Applicable documentation:

http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#acreldbwhatsnew902...

Go under the DBMS-Specific Reference Section and then select the SAS/ACCESS Interface you are trying to use, then LIBNAME Statement Specifics for that interface.

hari1109
Fluorite | Level 6

Hi Fried Egg,

Thank you for the reply and i have tried with the second libname statement and i am still not able to assign the libname statement.

I have my server name MSSQL09, database name ,schema name, user name and password , i am trying to connect using the libname statement in SAS.

Thank you for that INFO, i will look into it.

Thank you,

Harish. 


FriedEgg
SAS Employee

Are you licensed for the SAS/ACCESS interface for the database type you are trying to connect to?

Do you know what type of database you are connecting to?

Can you access the database by other means on the same machine you are trying to connect to it with SAS?

It sounds to me like you should contact your companies SAS Admin staff or technical support.

Try running the libname statement again with the following before the libname statement.  Copy and paste your log here:

options msglevel=i sastrace=',,t,ds' sastraceloc=saslog;

libname etc mysql user= pass= database= server= port=;

shivas
Pyrite | Level 9

Hi Harish,

Is it MSSQL or MYSQL?

syntax for MYSQL

LIBNAME xxx MYSQL  ESCAPE_BACKSLASH=YES  DATABASE=testn SERVER="xx.xx.xx.xxx"  MYSQL_PORT=3306  USER=dwh  PASSWORD="test" ;

Thanks,

Shiva

Ksharp
Super User

What is your LOG message ?

First of all, you should success to connect to MySQL by MySQL's client program.

SAS actually use MySQL's client software to talk to MySQL.

Ksharp

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2292 views
  • 6 likes
  • 4 in conversation