If you print the contents of the result set to the main output, what do you get?
Joined: Dec 09, 2009
Edwin Dalorzo wrote:If you print the contents of the result set to the main output, what do you get?
Hi Edwin Dalorzo,
I tried to get results (rs.getString(1), etc) I got SQLException...(w/c i think it means no result to get)
I also tried using SELECT COUNT(*) stuff and if rs.getInt(1) == 0 then shipment is not existing.
The select count(*) always returns a non-zero value...
I check the SQL query in Toad and there's no such shipment number...I think there's a ghost in DB..
This is the first time I encountered this...and man, it freaks me out...I even checked my old notes, and codes from previous projects, my code should be working....this is giving me headache!
Joined: Dec 31, 2004
May I ask what database and what drivers are we talking about here?
I just tried a similar scenario with a simple Derby database and it worked as expected. I daresay this could be a bug on the driver, but I would like to make sure before I affirm it.
If you print your sqlString once properly built with your variables, what do you get?
Joined: Dec 09, 2009
Im using Oracle DB using Oracle12_g.jar as jdbc driver on my localhost (im not sure in production server).
Oracle9i Enterprise Edition Release 126.96.36.199.0 - 64bit Production
PL/SQL Release 188.8.131.52.0 - Production
"CORE 184.108.40.206.0 Production"
TNS for HPUX: Version 220.127.116.11.0 - Production
NLSRTL Version 18.104.22.168.0 - Production
as well as you do, I'm very sure the java code works...I cross checked it using other tables and results are as expected. Only that particular table is problematic...
I printed to console the SQL query generated by java debugger and used it to query on TOAD sql editor, and works fine...as expected
I need a solution fast for this since im on tight schedule...but I will continue to solve this for future reference and for this forums reference as well to help other which might encounter the same problem in future and hopefully solve it.
Here's my quick fix for this wierd table for everyone's info Anyway I filed for table change...apparently my suggested work around for this it for the table to have a primary key (I noticed no primary key in table) ...Then if I violate PK constraint, Java will throw sqlexception then handle it accordingly, I will update if exception will match the vendor's error code.