MULTIPLE SQL SERVER DATABASES ODBC.INI SETTING

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ejazsalim
Premium Member
Premium Member
Posts: 51
Joined: Wed Apr 09, 2003 6:42 am
Location: VA, USA

MULTIPLE SQL SERVER DATABASES ODBC.INI SETTING

Post by ejazsalim »

Is it possible to access multiple SQL Server Databases running on the same server with a generic .odbc.ini setting.

My requirements does not allow me to create new entry into the .ODBC.INI file for every database in the server.

Here is a working .ODBC.INI file that has 2 entries going into the same SQL Server but different databases.

[BISOPINFSPH]
Driver=/opt/is/IBM/InformationServer/Server/branded_odbc/lib/VMmsss23.so
Description=DataDirect SQL Server Wire Protocol driver
Database=bisopinfsph
LogonID=uid
Password=pwd
Address=wassql001v,1433
QuotedId=No
AnsiNPW=No

[BISOPLOAN]
Driver=/opt/is/IBM/InformationServer/Server/branded_odbc/lib/VMmsss23.so
Description=DataDirect SQL Server Wire Protocol driver
Database=HABITAT03262010
LogonID=uid
Password=pwd
Address=wassql001v,1433
QuotedId=No


------ I tried doing ------
---------------------------
[WASSQL001V]
Driver=/opt/is/IBM/InformationServer/Server/branded_odbc/lib/VMmsss23.so
Description=DataDirect SQL Server Wire Protocol driver
Database=db
LogonID=uid
Password=pwd
Address=wassql001v,1433
QuotedId=No

I want to pass the DATABASE NAME as a parameter into the ODBC stage in paralell job.

Any advice would help
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: MULTIPLE SQL SERVER DATABASES ODBC.INI SETTING

Post by ray.wurlod »

ejazsalim wrote:My requirements does not allow me to create new entry into the .ODBC.INI file for every database in the server.
Tough. There's no other way to do it.

The DSN can be a job parameter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ejazsalim
Premium Member
Premium Member
Posts: 51
Joined: Wed Apr 09, 2003 6:42 am
Location: VA, USA

Post by ejazsalim »

Isnt there a way to pass the DSN name and database name as a string parameter to the ODBC Stage ???

Like
DSNNAME@DBNAME
Last edited by ejazsalim on Tue Jul 13, 2010 11:24 pm, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Of course you can pass any string into the job. But how are you planning to use it? The ODBC stages require the DSN to be separate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ejazsalim
Premium Member
Premium Member
Posts: 51
Joined: Wed Apr 09, 2003 6:42 am
Location: VA, USA

Post by ejazsalim »

I am at the end of my wits. The only way that I can think of is to change the .odbc.ini file at run-time (I personally dont like that idea as it might lead to more complications with multiple instances and other applications that might be using the same datastage project)

Will ask IBM and see if they have a better answer

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

They won't, they don't, there isn't one.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: MULTIPLE SQL SERVER DATABASES ODBC.INI SETTING

Post by chulett »

ray.wurlod wrote:
ejazsalim wrote:My requirements does not allow me to create new entry into the .ODBC.INI file for every database in the server.
Tough. There's no other way to do it.
Ray, I'm a little disappointed - where is your famous cry of 'Resist stupid requirements!'? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ejazsalim
Premium Member
Premium Member
Posts: 51
Joined: Wed Apr 09, 2003 6:42 am
Location: VA, USA

Post by ejazsalim »

A non datastage person (EX SQL Server DBA) provided the solution.

We created one SQLSERVER connection in the .odbc.ini file and the jobs connect using that DSN and in the BEFORE SQL of the ODBC stage we are switching the database using the SQL command

USE <SQL Server DB NAME>

** and prefix the table name with databasename like
wassql001v.dbo.table_name
Post Reply