Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2004

Tip: Looking for answers? Try searching our database.

Broken ResultSet with DB2 and JDBC

Thread view: 
Daniel Grundmann - 15 Jan 2004 09:41 GMT
Hi,
I have a serious problem, hopefully you can help:

I'm executing a simple select Statement like "Select * from <table> where
<column> = A".
The effect is that I can read several rows correctly but in one of the last
rows I can't get more Information from the Result set. The call
"resultSet.getObject(i)" does not return right in the middle of a row.

If I a non-JDBC-Tool the select works.
A "select count(*) from <table> where <column> = A" works.
If I change the parameter in the where-clause from "A" to "B" the select
works.

Any idea?
Im using the db2java.jar against a IBM DB2 V7.2

Thanks in advance,

Daniel
Robert Klemme - 15 Jan 2004 09:52 GMT
> Hi,
> I have a serious problem, hopefully you can help:
[quoted text clipped - 12 lines]
> Any idea?
> Im using the db2java.jar against a IBM DB2 V7.2

What is exactly A in your case?  Do you mean the String "A"?  Then you
must single quote it:
select * from <table> where <column> = 'A'

A general remark: DB2 and JDBC don't mix very well, from my experience.
But that's another story.

   robert
Daniel Grundmann - 15 Jan 2004 10:10 GMT
> > Hi,
> > I have a serious problem, hopefully you can help:
[quoted text clipped - 23 lines]
>
>     robert

Hi Robert,
the datatype is DECIMAL(18).
I think, it is not a Syntax-problem because I get parts of the ResultSet
with parameter 'A' and the whole ResultSet with any other Parameter
different from A (we are talking about over 1000 working selects!).

Daniel

P.S.: I prefer Oracle, too - but our customer doesn't :-(
DB2 - 15 Jan 2004 14:54 GMT
You could try with a specific JDBC driver for DB2, ie StarSQL:

http://www.starquest.com/Productfolder/starsqljava.html,

Bob

> > > Hi,
> > > I have a serious problem, hopefully you can help:
[quoted text clipped - 33 lines]
>
> P.S.: I prefer Oracle, too - but our customer doesn't :-(
David Rocks - 15 Jan 2004 15:12 GMT
    Which jdbc type are you using and do the drivers match between the
client and server? Are you getting any exceptions?

> You could try with a specific JDBC driver for DB2, ie StarSQL:
>
[quoted text clipped - 43 lines]
>>
>>P.S.: I prefer Oracle, too - but our customer doesn't :-(
Daniel Grundmann - 16 Jan 2004 09:10 GMT
The Database-Version is 7.2
If I decompile the DB2Driver it tells me that the Major-Version is 7 and
Minor Version is 1.
But the class belongs to the DB2java.zip that is shipped with the IBM DB2
V7.2 !?

> Which jdbc type are you using and do the drivers match between the
> client and server? Are you getting any exceptions?
[quoted text clipped - 46 lines]
> >>
> >>P.S.: I prefer Oracle, too - but our customer doesn't :-(
David Rocks - 16 Jan 2004 16:27 GMT
    Version 7 went (and is going through) about 12 revisions. There will be
a third number that indicates the correct 'fixpak' so the version will
come out as 7.1.X. Everything after 7.1.4 is actually 7.2. There are
some java tools around that will give you the versions of the database
you are talking to and the driver you are using to communicate. In any
case, you need to have the db2java.zip on the client at the same level
as on the server. Since this is really a jar file, the easiest way is to
get the db2java.zip off the server and ftp it to the client or make sure
that is the file being picked up by your app. Don't worry if it is a
different OS, this is java after all.
    You also need to make sure you have chosen the db2java.zip at the right
jdbc level. In an effort to please everyone IBM shipped both jdbc 1.1
and jdbc 1.2 files, each in their own directories. For whatever reason
they made 1.1 default. That means that you may run into 'not supported'
errors if you don't make sure you are using the right files(on both
client and server). Under windows and aix, script/bat files were
included to fix it so the path picked up the right version. I assume
they did so in all their implementations. I haven't seen ver 8 of DB2
but I think they abandoned this peculiarity. The following pages give
some info and links:

> http://www.datadirect-technologies.com/download/docs/slnk/devref/datatype.htm

> http://www-106.ibm.com/developerworks/db2/library/techarticle/0203zikopoulos/020
3zikopoulos.html

> http://www-1.ibm.com/support/docview.wss?rs=71&org=SW&doc=1000797&loc=en-us

> http://www-306.ibm.com/software/data/db2/udb/ad/v7/java.html

> The Database-Version is 7.2
> If I decompile the DB2Driver it tells me that the Major-Version is 7 and
[quoted text clipped - 59 lines]
>>>>
>>>>P.S.: I prefer Oracle, too - but our customer doesn't :-(
Robert Klemme - 19 Jan 2004 11:34 GMT
> Version 7 went (and is going through) about 12 revisions. There will be
> a third number that indicates the correct 'fixpak' so the version will
[quoted text clipped - 6 lines]
> that is the file being picked up by your app. Don't worry if it is a
> different OS, this is java after all.

Is that sufficient?  AFAIR the DB2 JDBC driver was not a pure Java driver
but contained some native part that resides in a shared lib.

Kind regards

   robert

> You also need to make sure you have chosen the db2java.zip at the right
> jdbc level. In an effort to please everyone IBM shipped both jdbc 1.1
[quoted text clipped - 8 lines]
>
> > http://www.datadirect-technologies.com/download/docs/slnk/devref/datatype.htm

http://www-106.ibm.com/developerworks/db2/library/techarticle/0203zikopoulos/020
3zikopoulos.html


http://www-1.ibm.com/support/docview.wss?rs=71&org=SW&doc=1000797&loc=en-us

> > http://www-306.ibm.com/software/data/db2/udb/ad/v7/java.html
>
[quoted text clipped - 61 lines]
> >>>>
> >>>>P.S.: I prefer Oracle, too - but our customer doesn't :-(


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.