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 / General / April 2005

Tip: Looking for answers? Try searching our database.

JDBC / ODBC problem

Thread view: 
goli - 07 Apr 2005 07:53 GMT
Hi,
I posted a message about a problem in UNION query.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_frm/thread/
f76e504d58ad7d47/310c36512df95818?q=sql+union+in+java&rnum=1#310c36512df95818


I have some more information:
The issue is as follows:
Suppose I have query A (using INNER JOIN) - number of rows in result =
10
Suppose I have query B (using INNER JOIN) - number of rows in result =
7
Query C is UNION of A and B, and I expect 17 rows in the result.
But I get only *7* !!!

If I change DB so query A will have 9 rows, the UNION will give me also
9 results.

Is it an ODBC or JDBC problem ?
Is it the ResultSet class problem ?
Maybe I get the results wrong. I use "while resultSet.next() { .. }

Here are results in excel table:
A           B           C           A - one less    C - one less
174285826    174262785    174262785    174285834    174262785
174285834    174262801    174262801    174285835    174262801
174285835    174262817    174262817    174285836    174262817
174285836    174262833    174262833    174285837    174262833
174285837    174263935    174263935    174285838    174263935
174285838    174264578    174264578    174285839    174264578
174285839    174265346    174265346    174285840    174265346
174285840    174285847    174285826    174285841    174285834
174285841    174286035    174285834    174285843    174285835
174285843               174285835    174285844    174285836
174285844               174285836    174285845    174285837
174285845               174285837

Thanks for any help.
AlexKay - 07 Apr 2005 08:24 GMT
> Hi,
> I posted a message about a problem in UNION query.

http://groups-beta.google.com/group/comp.lang.java.programmer/browse_frm/thread/
f76e504d58ad7d47/310c36512df95818?q=sql+union+in+java&rnum=1#310c36512df95818


(snip)

> Is it an ODBC or JDBC problem ?
> Is it the ResultSet class problem ?
> Maybe I get the results wrong. I use "while resultSet.next() { .. }

Sorry I don't have time to dig into your code but I would not be
surprised if you find bugs in databases, JDBC or ODBC drivers. Actually
I would be surprised if you didn't find any ;-|

I'll presume your code is correct and there is a bug beyond your direct
control, often the only recourse is to find a work around or
alternative. Do the query differently.

I'm using Oracle and one of its JDBC drivers and I find plenty of
problems. Today I need to code a query with MINUS, my confidence that
it'll actually work is pretty low. I'm automatically thinking of
alternatives.

Cheers,
Alex
christopher@dailycrossword.com - 08 Apr 2005 05:16 GMT
I usually sys.out my sql queries (because I build them on the fly),
then cut and paste them in the MySQL front end in a telnet window.  I
have found the darndest mistakes that way.

luck
AlexKay - 08 Apr 2005 12:12 GMT
> I usually sys.out my sql queries (because I build them on the fly),
> then cut and paste them in the MySQL front end in a telnet window.  I
> have found the darndest mistakes that way.
>
> luck

Hey yeah,

I do that too, goli I take back my original assumption that you code
has no bugs .. maybe it does?

I agree with christopher here, you should really check your SQL as
well, maybe you'll find a bug in your sql statement after all? .. it
does happen to the best of us ... ;-)

Cheers.


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.