Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Uses the User Name Rather than DB name? 3

Status
Not open for further replies.

daiglebob

Programmer
Mar 31, 2006
4
US
For some reason when attempting to access the DB2 database named "DB2ISDB" (through ODBC) it seems to append the user name "Robert" rather than the expected database name (DB2ISDB).
I'm rather new to DB2 but this seems rather strange and I can't find anything that points me in the right direction on this issue.
The error below is expected if the user name is used and I suspect this is caused by the use of the ODBC driver.
I know the details are limited here but anything that would put me on the right path would be appreciated.

2006-03-31 13:00:43 Portal <Demo Portal> ERROR: CPortalOdbc::SessionFieldsDbPopulate( 23554903 ) Failed. CDBExeption Caught
ODBC API Error: -1; Error Description: SQL0204N "ROBERT.G2A_SESSIONS" is an undefined name. SQLSTATE=42704
State:S0002,Native:-204,Origin:[IBM][CLI Driver][DB2/NT]
 
When you do not specify a schema name , DB2 will assume that authentication is the schema. Hence the 'ROBERT.G2A_SESSIONS'.
Omitting the schema will only work on objects that are created (or placed) by the authentication_id.


Ties Blom

 
Thank you Ties for confirming this!
The database is known (this case "DB2ISDB") and there is a Schema listed with the same name so is there are resaon you know of, that the same name is not used instead of the authentication schema?
It seems like several other databases don't do this.
Is there any way to make it use the database name when the schema is not specified (registry entry or .ini file)?
 
What platform are you running on. On the AS400, you can specify a default schema in the odbc dsn. I don't know if it is the same for unix or windows.
 
Well, normally an object will be created within a schema, say: target.table1.
The database name is a higher level.

Did you try to use the schema with the object? I bet it will be something different then 'robert' in your case

Ties Blom

 
ddiamond... The platform is a WinXP Pro and I tried this but it doesn't look like this is supported.
It does look like I can create a user on my WinXP called "DB2ISDB" (same as the schema name) and now this seems to be working although this method seems rather odd to me.

Ties, I didn't use the schema with the object because I would have to change some existing code the sends data to a data base (like MYSQL, ORACLE, Ingres ... currently works with these DBs). I'd like to include DB2 if I can get around the problems I'm having.
-------
The error I get now is related to fields needing to be set to nullable.
I'm having problems "altering" one of my 6 tables. Five of the tables can be changed (simple change like changing "Nulable" from No to Yes). One of the tables will not allow a change and gives the below error.
This seems like some kind of corruption problem but I can't be sure.
It doesn't make much sense that just one table has this problem and the others don't. The table that is having problems is much larger so it's possible that has something to do with the problem.

The error I get is …
[IBM][CLI Driver][DB2/NT] SQL0443N Routine "ALTOBJ" (specific name "") has returned an error SQLSTATE with diagnostic text "SQL0104 Reason code or token: "LONG VARCHAR"|, SMARTBOX_QUEST". SQLSTATE=38553

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top