Our setup allows us to specify different databases on the same server with only one odbc.ini entry, but there's still a DSN. I agree, it would be useful to be able to specify a connection completely without creating a new odbc.ini entry for each server, but I couldn't find a way to do it. One problem is that connection strings can't be combined with AUTHDOMAIN= for authentication, and we don't want to hard-code passwords in a connection string.
What we do, leaving out many many lines from this condensed version:
odbc.ini
[dor_sqlserver_prod]
Driver=/opt/sas94_install/sashome/compute/AccessClients/9.4/SQLServer/lib/S0sqls27.so
Database=
HostName=SQLAGL.KP-DOR.KAISER.ORG
In my SAS code, I could libref to database "a" with
libname sqlliba sqlsrv dsn=dor_sqlserver_prod qualifier=A;
and to database "b" as
libname sqllibb sqlsrv dsn=dor_sqlserver_prod qualifier=B;
The alternative would be to have two odbc.ini entries:
[A]
Driver=/opt/sas94_install/sashome/compute/AccessClients/9.4/SQLServer/lib/S0sqls27.so
Database=A
HostName=SQLAGL.KP-DOR.KAISER.ORG
[B]
Driver=/opt/sas94_install/sashome/compute/AccessClients/9.4/SQLServer/lib/S0sqls27.so
Database=B
HostName=SQLAGL.KP-DOR.KAISER.ORG
There are additional entries in odbc.ini and odbcinst.ini to define the drivers. I hope I didn't abstract anything important out of this code when I edited it.
Either SAS or DataDirect (or both) didn't do a careful job when setting this up. Sometimes case matters for the DSN and QUALIFIER, and sometimes it doesn't. If you get the case wrong, sometimes the code partially works and sometimes it fails completely. Also, it would be a big improvement if the Unix driver supported bulk loading.
... View more