This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Miran Cvenkel
Ranch Hand
Posts: 196
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic