Hi All,
I have to establish a connection to SQL Server using SAS/ACCESS with ODBC but I don't know which DSN should be use to start the process, UserDSN, SystemDSN or FileDSN.
what is the difference between accessing SQL Server using ODBC OR ODE BD.
I am referring the attached document.
Regards
Anand Sahu
Besides the answer you already have, here are couple of other things you may want to consider:
1. File DSN, just like System DSN, is also not user restricted. Once created, it can be shared by many different users, as it is just a file containing connection information.
2. OLEDB vs. ODBC. First, you need to make sure you have license for either of them to start with. ODBC is an open relational database connection API that most of the database manufactures will support. OLEDB is a Microsoft API that works with Oracle in addition to its own database, Access and SQL server. I haven't seen any benchmarks on the efficiency comparison between these two, but they maybe outthere somewhere.
3. You don't have to define any DSN to be able to connect, as long as you have the driver installed. For example, this works for a SQL server database:
libname test odbc schema="dbo" bulkload=YES noprompt="server=yourservername,31723;DRIVER=SQL Server;Trusted_Connection=yes;database=yourdatabasename";
Good luck,
Haikuo
There is a name you need to type when you make a ODBC connection with SQL.
Hi Xia keshan,
I just want to know the usage and approach of selecting either UserDSN, SystemDSN or FileDSN. Its clearly mentioned on the attached document that we need to put a server name.
I would start with SystemDSN as that just means its available to anyone using your computer. UserDSN is only available to the user that created it.
It doesn't matter if it is UserDSN or SystemDSN .. as long as you can connect to SQL Database.
Besides the answer you already have, here are couple of other things you may want to consider:
1. File DSN, just like System DSN, is also not user restricted. Once created, it can be shared by many different users, as it is just a file containing connection information.
2. OLEDB vs. ODBC. First, you need to make sure you have license for either of them to start with. ODBC is an open relational database connection API that most of the database manufactures will support. OLEDB is a Microsoft API that works with Oracle in addition to its own database, Access and SQL server. I haven't seen any benchmarks on the efficiency comparison between these two, but they maybe outthere somewhere.
3. You don't have to define any DSN to be able to connect, as long as you have the driver installed. For example, this works for a SQL server database:
libname test odbc schema="dbo" bulkload=YES noprompt="server=yourservername,31723;DRIVER=SQL Server;Trusted_Connection=yes;database=yourdatabasename";
Good luck,
Haikuo
thank you Hikuo...
I just need to know one more thing that how can I examine whether a system has SAS/ACCESS as I would be making connecting remotely on client's system. They use window SAS.
SAS/ACCESS is for you to ACCESS relational database or other data format other than SAS tables; SAS/CONNECT is for you to remotely link two SAS instance. Both can be checked using:
proc setinit;run; /*for licensing*/
proc product_status;run;/*for installation*/
Good luck,
Haikuo
One more thing....why do we Authenticate SQL Server and what is NT Authentication.
I know..these questions sound like stupid question but its first time I am going to make a connection tomorrow.
You need credentials to access a database. Your credentials (password, userid) can be assigned at OS level (eg. NT authentication) or the database level ( eg. SQL server authentication). Usually OS level authentication (eg. IWA) would be a better option.
Are you excited
Haikuo
Hi Haikuo,
I did it.
Thank you so much your inputs really help a lot.
But I faced a problem while running Prompted Connection as per the document after establishment the ODBC DSN connection.:smileyconfused:
%put %superq(sysdbmsg);
above statement threw an error, I couldn't note the error, which caused problems as It gives an "ODBC:" statement with WSID and I am not aware of it.
LIBNAME SQL ODBC prompt;
NOTE: Libref SQL was successfully assigned as follows:
Engine: ODBC
Physical Name: sqlsrv
7 %put %superq(sysdbmsg);
ODBC: DSN=sqlsrv;UID=jebjur;PWD=jebjur1;WSID=d17117
So typed LIBNAME statement manually as its mentioned in the document i.e. WSID=d17117,
LIBNAME SQL ODBC noprompt= "dsn=sqlsrv; uid=himdw; pwd=******; wsid=d17117";
Initially the SQL library created but there were no datasets but after some it started showing tables in the same library. I really couldn't figure out what was the reason. So could you please share views on it.
Regards
Anand Sahu
While I am not entirely familiar with this 'prompt' approach, but it seems to me just a way of entering credentials when prompted. WSID is Windows System ID, so it should be your computer name registered in active domain. %superq(sysdbmsg) is to replay whatever you have just entered for your connection. The reason why there was no table and then there were, I am not sure. But one thing obvious to me is that I didn't see SCHEMA= option anywhere in your connection string. This will point your library to your own schema or some other default schema configured in your SQL server database.
Good luck,
Haikuo
I used LIBNAME SQL ODBC DSN=sqlsrv user=sasjlb pw=pwd schema=dbo;
after above statements.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: