Jump to content
  • Advertisement
Sign in to follow this  
antareus

[java] Unable to execute a simple SQL statement

This topic is 4908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

At work I need to instruct our Sybase Adaptive Server IQ DB to bulk load from a file at periodic times. The LOAD TABLE command seemed to fit the ticket perfectly, so I built the command and the options from an Interactive SQL session, verifying that the statement was correct. However, when I moved it over to a Java program, it doesn't seem to really do anything. Upon inspection of the server logs, it shows the server as claiming it can't find the end of the record -- which is bollocks. I'm not sure what would cause it to work in one place, and not another. I'm using Sybase's JDBC driver and just barely changing example code from their website. I looked at this all day. Usenet isn't a ton of help, some people claim you can't issue a LOAD TABLE command from JDBC, while others claim you can. I investigated dynamic SQL creation in Sybase, but that is not as easy as one would think, however.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I would point the finger of blame at the JDBC driver.

Bear in mind that most JDBC drivers are pretty crap when it comes down to the infrequently used functions. Whenever I get a problem like this, I:

- check whether I've got the latest driver (they get updated fairly often for most vendors)
- check the bugs list (If I have access to it)
- file a new bug report, and see what happens

If it works on the interactive client then, theoretically, you have good grounds for logging a bug.

Unless you've got a "funky" client setup which is doing some post-processing of your query before sending it?

Share this post


Link to post
Share on other sites
"Finger of blame?"
For many times I got alot of errors in jdbc driver
untill i started use PrepareStatement before each sqlstring and this ocassionaly ? solved all my problems with this "crap driver" :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by HellCreator
For many times I got alot of errors in jdbc driver
untill i started use PrepareStatement


With a decent IDE you shouldn't get many of those. Certainly, it's not particualrly relevant for this thread, since the OP said he'd tested it in an interactive session and it worked.

If you do enough JDBC work, you discover plenty of situations where your SQL is perfect but the driver (or DB) is broken.

However, if you have problems with typos, I strongly suggest picking up an abstraction layer, or something like Hibernate - I agree it's annoying that there's no compile-time checking on SQL queries embedded in java code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!