473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

JDBC: Connected but no tables shown

Hi,

I am connecting to a DB2 v7.1 server from windows using JDBC type 2 (I
figured out that type 4 is only for 8 and upwards).

I used DB2 Connect to create a system DSN and seem to be able to
connect fine using db2connect and run queries etc.

The problem is when I try to use my java application to connect using
the same DSN. The way the db has been configured is that I am
connecting using a specific userid - this has been configured within
the System DSN. But the tables I need to read are owned (or created)
by another user. So I need to use the prefix of the owner/ creator to
access the tables. As of now no tables are shown.

I am using a product called IDM which basically connects to the DB2
Datasource (DSN) and once connected, it shows all tables available to
the user. I think what it does not know is that I might want to access
other tables which are not directly owned by this user (who is
configured in the DSN). Is there someway in the DSN or in the
connection string that I can tell jdbc to look at tables owned by
other users?

The parameters accepted by the jdbc client are: (and the values I
provided)

JDBC Driver : COM.ibm.db2.jdbc.app.DB2Driver
JDBC URL Template jdbc:db2:VISION
** I do not need to provide the following info if I give the URL **
Host
TCP Port
Database
User
Password

There are no errors when I connect, but no tables are shown.

Another thought is that in Oracle we use SYNONYMs, would that be a
viable option here.

Thanks
Anoop

Jun 25 '07 #1
2 6657
When you connect to db2 your schema (by default) is set to your
userid. These "other users" probably created their tables,etc under
their own schema.
You can access these tables without qualifying the statement by
issuing the following commands on your connection.

set schema <schemaname>
set path SYSFUN,SYSPROC, <schemaname>

You can set this on the driver programmatically with the
setCurrentSchema(schemaname) and setCurrentFunctionPath(path) methods
on the datasource.

Or you can set the driver params on the URL.
i.e I think it would be something like this for your case:
jdbc:db2:VISION?
currentSchema=<schemaname>;currentFunctionPath=SYS FUN,SYSPROC,<schemaname>;

Jun 29 '07 #2
On Jun 29, 3:21 am, Otto Carl Marte <Otto.Ma...@gmail.comwrote:
When you connect to db2 your schema (by default) is set to your
userid. These "other users" probably created their tables,etc under
their own schema.
You can access these tables without qualifying the statement by
issuing the following commands on your connection.

set schema <schemaname>
set path SYSFUN,SYSPROC, <schemaname>

You can set this on the driver programmatically with the
setCurrentSchema(schemaname) and setCurrentFunctionPath(path) methods
on the datasource.

Or you can set the driver params on the URL.
i.e I think it would be something like this for your case:
jdbc:db2:VISION?
currentSchema=<schemaname>;currentFunctionPath=SYS FUN,SYSPROC,<schemaname>;

That looked promising, but with that url syntax, the connection just
wouldn't go through. here is the error stack trace I get:

COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0124E Invalid
argument value. SQLSTATE=HY009
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(Unknown
Source)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(Unknown
Source)
at COM.ibm.db2.jdbc.app.DB2Connection.connect(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2Connection.<init>(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:
512)
at java.sql.DriverManager.getConnection(DriverManager .java:
171)
at jdbctest.connect(jdbctest.java:297)
at jdbctest.main(jdbctest.java:79)
Error code is: -99999
SQLState is: HY009
Connection to jdbc:db2:VISION?
currentSchema=VIS;currentFunctionPath=SYSFUN,SYSPR OC,VIS; failed!

But thanks,
Anoop

Jul 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web...
3
by: Steverino | last post by:
Hi, I'm currently trying to learn DB2. I have the following version below installed on my server machine on my little LAN. However when I try to connect to it from my client machine, I receive...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
1
by: Praveen | last post by:
Hi, I have installed WebSphere Portal on AIX and connected to DB2 on a remote machine, Getting the followin errors when trying to get the values from database thru applications installed on...
5
by: Andy Davis | last post by:
I have a two tables, Users and Requests, the latter which displays the daily log on's of 20 users. Both tables are related by a one-to-many relationship in the Requests table via the UserId field....
13
by: delram | last post by:
Hello All! I've been struggling with this problem for a while. I have a database from which I need to read and display some data on a browser. (The database is set up for remote access). ...
3
by: codeninja | last post by:
Hello, I'm trying to write a jsp page that calls a java class, which accesses a MYSQL database, and for some reason i get "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" while trying to...
2
by: dvawdrey | last post by:
Can someone help me please with the following code: try { DatabaseMetaData metadata=con.getMetaData(); System.out.println(metadata.getDriverName()); System.out.println("Driver version:...
2
by: kprojects | last post by:
Hello, I'm stuck with the same problem for a few days already. In my applet, in which users can login to see their account details, I want to connect to my databases which is located at localhost....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.