File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Insert into db does not work, no errors doh !? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Insert into db does not work, no errors doh !?" Watch "Insert into db does not work, no errors doh !?" New topic
Author

Insert into db does not work, no errors doh !?

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 149
This is my code for executing sql. I have a prob with one table/insert query where I send in 'INSERT into ....', nd nothing happens, no error , no exception, no data in table
If I copy sql out in debug time and execute it in some client software it works OK.




Any ideas ?


Searchable nature photo gallery: http://agrozoo.net/jsp/Galery.jsp?l2=en
Ralph Cook
Ranch Hand

Joined: May 29, 2005
Posts: 479
Can con be null? That would throw null pointer and wouldn't be caught by your SQLException.

Can prepareStatement(String sql) throw an exception that is not a SQLException? It seems to me you are likely throwing some exception out of that first line in the try block. If prepareStatement doesn't like your SQL statement, can it throw some Throwable like IllegalArgumentException?

You wanted ideas...
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 149
Yea, right. The connection was null. Thanks.

Bottom line:

The code was old and untouched , so it should work.
Drilling down, figured that some foregin key is somehow corrupted, although looking good.
Deleted it and now it works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Insert into db does not work, no errors doh !?