473,854 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.jdb c.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 6673
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 programmaticall y with the
setCurrentSchem a(schemaname) and setCurrentFunct ionPath(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>;cur rentFunctionPat h=SYSFUN,SYSPRO C,<schemaname>;

Jun 29 '07 #2
On Jun 29, 3:21 am, Otto Carl Marte <Otto.Ma...@gma il.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 programmaticall y with the
setCurrentSchem a(schemaname) and setCurrentFunct ionPath(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>;cur rentFunctionPat h=SYSFUN,SYSPRO C,<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.jdb c.DB2Exception: [IBM][CLI Driver] CLI0124E Invalid
argument value. SQLSTATE=HY009
at
COM.ibm.db2.jdb c.app.SQLExcept ionGenerator.th row_SQLExceptio n(Unknown
Source)
at
COM.ibm.db2.jdb c.app.SQLExcept ionGenerator.ch eck_return_code (Unknown
Source)
at COM.ibm.db2.jdb c.app.DB2Connec tion.connect(Un known Source)
at COM.ibm.db2.jdb c.app.DB2Connec tion.<init>(Unk nown Source)
at COM.ibm.db2.jdb c.app.DB2Driver .connect(Unknow n Source)
at java.sql.Driver Manager.getConn ection(DriverMa nager.java:
512)
at java.sql.Driver Manager.getConn ection(DriverMa nager.java:
171)
at jdbctest.connec t(jdbctest.java :297)
at jdbctest.main(j dbctest.java:79 )
Error code is: -99999
SQLState is: HY009
Connection to jdbc:db2:VISION ?
currentSchema=V IS;currentFunct ionPath=SYSFUN, SYSPROC,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
4499
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 Server 6.1 with the SQL Server 2000 JDBC Driver. The background: 1. I have downloaded the SQL Server 2000 JDBC Driver and installed it on the web server.
3
6065
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 the following error: CLI0621E Unsupported JDBC server configuration. Everything I've read on the net though pertains to a Unix based setup
4
6353
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 found that it was shifted three Bytes to the left, i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This means that the value written and the value read sometimes do not match, which is of course inacceptable for all real world...
1
9040
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 Portal. Any Help Appreciated. Thanks in advance. Praveen Singh
5
1673
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. I want to run a query that when I enter a date shows all the users that DID NOT connect for that particular day. For example, say user id's 1 and 2 were on the system on a particular day but user id's 3 - 20 were not, how do I display just...
13
2455
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). I'm using the following JSP/JDBC code to do that. ---------------------------------------------------------------------------------------------- Class.forName ("com.mysql.jdbc.Driver").newInstance();
3
3832
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 establish the connection. I tried putting the connector .jar in the WEB-INF\lib, I tried setting the classpath variable to the connector's location, and nothing seems to fix it. Am I using the wrong class for the driver, or is it something else. Here...
2
8632
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: " +metadata.getDriverVersion()); System.out.print("JDBC version: " + metadata.getJDBCMajorVersion()); System.out.println("." +metadata.getJDBCMinorVersion());
2
1701
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. This is perfectly possible in an application but nearly impossible in an applet. If some of you guys figured this out before please help me. benieth you will find the code I've used: users_db is the database i use and 3306 is the default...
0
9899
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9750
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10672
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10740
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10362
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5937
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.