Oracle OCI Connect Error
Moderators: chulett, rschirm, roy
Oracle OCI Connect Error
Hi Everyone,
I'm having some problems connecting to our database server through my routine.
I get the following error:
************************************************************
Error Text: [DataStage][SQL Client][ODBC][DataDirect][ODBC lib] Data source name not found and no default driver specified
Error Status: 0
************************************************************
This is with the assumption that the DSN for Oracle is the same as one of the entries in tnsnames.ora (which I have used in the code).
Was I correct in using that name?
Thanks!
Cedrick
I'm having some problems connecting to our database server through my routine.
I get the following error:
************************************************************
Error Text: [DataStage][SQL Client][ODBC][DataDirect][ODBC lib] Data source name not found and no default driver specified
Error Status: 0
************************************************************
This is with the assumption that the DSN for Oracle is the same as one of the entries in tnsnames.ora (which I have used in the code).
Was I correct in using that name?
Thanks!
Cedrick
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard! :D
You have a little more setting up to do. You are apparently using the ODBC stage, rather than the Oracle OCI stage; the latter would use the name in tnsnames.ora and not complain; certainly it wouldn't give an error with [ODBC] (the ODBC driver manager) in it!
In the DataStage engine directory, edit the .odbc.ini file. Use the appropriate Oracle example there as your guide to create a data source name with appropriate library name and other information.
In the DataStage project directory, edit the uvodbc.config file. At the very list you need the data source name and "DBMSTYPE = ODBC" (and there must be space characters either side of the "=".
You have a little more setting up to do. You are apparently using the ODBC stage, rather than the Oracle OCI stage; the latter would use the name in tnsnames.ora and not complain; certainly it wouldn't give an error with [ODBC] (the ODBC driver manager) in it!
In the DataStage engine directory, edit the .odbc.ini file. Use the appropriate Oracle example there as your guide to create a data source name with appropriate library name and other information.
In the DataStage project directory, edit the uvodbc.config file. At the very list you need the data source name and "DBMSTYPE = ODBC" (and there must be space characters either side of the "=".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can do either, but I'd recommend creating a new entry so that the original remains intact. In any case, as with any "system" file, make sure you've got a backup copy before changing it, and document any changes you make (so that someone else doesn't reverse them later!).
Or you can use an Oracle OCI stage, and thereby employ the OCI software directly.
Or you can use an Oracle OCI stage, and thereby employ the OCI software directly.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
:Dchulett wrote:What he said.ray.wurlod wrote:Or you can use an Oracle OCI stage, and thereby employ the OCI software directly.
Don't use the ODBC stage unless you've really really got no other choice.
I'm sorry if do not quite understand... but does this mean that if I use this routine in an OCI stage, I do not have to worry about this?
Oh man.. I'm confused..
Sorry, didn't mean to confuse. During discussion of the problems of trying to get a routine to connect to Oracle, the use of an ODBC stage came up. And then an 'or' - or use an OCI stage. My only point was to encourage the use of a native stage, like an OCI stage, over the generic ODBC stage. Unless you've got no choice but to use an ODBC stage.
This has nothing to do with getting your routine to work... unless the work you are doing in the routine could be more 'properly' handled by a job instead. BTW, what exactly does your routine do? Or perhaps what do you mean by 'routine' - literally a custom DataStage routine or something else?
This has nothing to do with getting your routine to work... unless the work you are doing in the routine could be more 'properly' handled by a job instead. BTW, what exactly does your routine do? Or perhaps what do you mean by 'routine' - literally a custom DataStage routine or something else?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I was hoping to get the field values for this SQL statement (or something like it). The thing is, the 'TEXT' within the SQL statement is part of an input file (seq file), and I do not know how I would pass this value to an OCI stage whose SQL is as shown below. So I thought of using a routine, and return a string that would be much easier to parse.
** SQL STATEMENT **
SELECT VNDR_NAME_SHRT_USR, MAX(VNDR_NAME_SEQ_NUM)
FROM PS_VENDOR
WHERE VNDR_NAME_SHRT_USR IN
(SELECT 'TEXT' FROM DUMMY_TBL
UNION
SELECT RPAD(SUBSTR('TEXT',1,10-RN),10,'x')
FROM (SELECT ROWNUM RN FROM PS_VENDOR WHERE ROWNUM <= 10)
GROUP BY VNDR_NAME_SHRT_USR
HAVING MAX(VNDR_NAME_SEQ_NUM) >0
AND MAX(VNDR_NAME_SEQ_NUM) < 990
** END **
Now I know that there's an easier way than to slap this SQL statement there, but I would have to (a) loop through a select statement a couple of times, or (b) use a much simpler SQL statement but a slightly more complex routine
For option (a), I don't know if it's possible without using a routine
For option (b), I could do this, but I couldn't connect to our database (see above).
Thanks guys, this little discussion of ours is teaching me a lot.
** SQL STATEMENT **
SELECT VNDR_NAME_SHRT_USR, MAX(VNDR_NAME_SEQ_NUM)
FROM PS_VENDOR
WHERE VNDR_NAME_SHRT_USR IN
(SELECT 'TEXT' FROM DUMMY_TBL
UNION
SELECT RPAD(SUBSTR('TEXT',1,10-RN),10,'x')
FROM (SELECT ROWNUM RN FROM PS_VENDOR WHERE ROWNUM <= 10)
GROUP BY VNDR_NAME_SHRT_USR
HAVING MAX(VNDR_NAME_SEQ_NUM) >0
AND MAX(VNDR_NAME_SEQ_NUM) < 990
** END **
Now I know that there's an easier way than to slap this SQL statement there, but I would have to (a) loop through a select statement a couple of times, or (b) use a much simpler SQL statement but a slightly more complex routine
For option (a), I don't know if it's possible without using a routine
For option (b), I could do this, but I couldn't connect to our database (see above).
Thanks guys, this little discussion of ours is teaching me a lot.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Hi,
Create the routine code as an Oracle Stored procedure and this procedure can be called from before/after SQL of the Oracle OCI stage. Then you do not need to create ODBC DSN and other entries. This will work as long as you are able to connect to Oracle DB using OCI stage.
Hope this would help.
Regards
Saravanan
Create the routine code as an Oracle Stored procedure and this procedure can be called from before/after SQL of the Oracle OCI stage. Then you do not need to create ODBC DSN and other entries. This will work as long as you are able to connect to Oracle DB using OCI stage.
Hope this would help.
Regards
Saravanan
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Good tip. Thanks for the advice!elavenil wrote:Hi,
Create the routine code as an Oracle Stored procedure and this procedure can be called from before/after SQL of the Oracle OCI stage. Then you do not need to create ODBC DSN and other entries. This will work as long as you are able to connect to Oracle DB using OCI stage.
Hope this would help.
Regards
Saravanan
No I have not specify an SID nor is there a default. I'm wondering.. maybe the syntax I'm using is wrong. I had pulled my code from this forum and had just changed the values so that they would fit my routine. Apparently, I'm doing something wrong.Sainath.Srinivasan wrote:You can try to print the sql statement in sqlplus (on DS Server) and run the same. Did you mention a specific Oracle SID or is there any default set for this?
How would I connect to the database using BCI? Would the SQLDBConnect statement work the same way? What parameters do I need to pass, because I believe that you need to pass UID,PWD,DSN for ODBC using databases.
I mean, I maybe looking at it the wrong way.