467,171 Members | 1,248 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,171 developers. It's quick & easy.

How can i connect to tables created in a schema with a username different from the schema name?

Hi,
I have tables created in my DB2 database created under a schema. Now i
want to get connected to these tables with a username different from
this schema name from my java application. When i give the user name in
my JDBC connection parameters, Its appending this username to the
tables like username.tablename and thorws exceptions as the tables does
not exists. How can i resolve this?? Help me!!!
Thanks in advance,
Sastry.

Mar 16 '06 #1
  • viewed: 1498
Share:
2 Replies
<sa********@gmail.com> wrote in message
news:11*********************@j52g2000cwj.googlegro ups.com...
Hi,

I have tables created in my DB2 database created under a schema. Now i
want to get connected to these tables with a username different from
this schema name from my java application. When i give the user name in
my JDBC connection parameters, Its appending this username to the
tables like username.tablename and thorws exceptions as the tables does
not exists. How can i resolve this?? Help me!!!
Thanks in advance,
Sastry.


Any of these should work:

1. Use the set schema statement
2. Fully qualify the table names in your code (select from
schema.table-name)
3. create an alias for each table
Mar 16 '06 #2
Hi,

Thanks for the reply. I resolved the issue in the following manner.
I have given currentSchema attribute to my database url while getting
the JDBC connetion.

The syntax is
jdbc:db2://<host>:<port>/<DB>;currentSchema=<schema name>

Thanks
Sastry

Mar 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by lkrubner@geocities.com | last post: by
reply views Thread by Mike Chirico | last post: by
2 posts views Thread by David++ | last post: by
12 posts views Thread by nyathancha@hotmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.