• Post Reply Bookmark Topic Watch Topic
  • New Topic

Very strange JDBC issue.  RSS feed

 
Chase Bonham
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I issue an insert statement using a PreparedStatement, my System.out.println(..) shows that the number of rows updated is 1 however, the table does not have the row. No exceptions thrown.

This is happening

1) regardless of the true/false autocommit flag on the connection.
2) No triggers on the table
3) FK conditions are being met
4) There is grant insert option is given to the db user making the call.

I figure 2,3,4 will throw an error. But i don't see any errors.

Oracle 10g.

what gives?

[ July 29, 2006: Message edited by: Chase Bonham ]

[ July 29, 2006: Message edited by: Chase Bonham ]
[ July 29, 2006: Message edited by: Chase Bonham ]
 
Sachin Dimble
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chase,
Have you closed the connection if not close it and then let me know the problem!

-Sachin!!!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24216
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to JDBC.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lot of ways to debug. First thing is how much you are sure that the SQL was executed at the DB?. You can try to see the statements carried out by the DB by quering V$ tables like V$SQLTEXT. The other way is to fire a query to fetch the recently inserted row and see if we can get the row back. This has to happen in the same transaction (right after executeUpdate call). If you can post the code it will be more help to find out.
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Purushothaman Thambu:
There are lot of ways to debug. First thing is how much you are sure that the SQL was executed at the DB?. You can try to see the statements carried out by the DB by quering V$ tables like V$SQLTEXT. The other way is to fire a query to fetch the recently inserted row and see if we can get the row back. This has to happen in the same transaction (right after executeUpdate call). If you can post the code it will be more help to find out.


The anothe alternative is ...

just try to run that query directly at DB.

Recently I faced a problem when i was inserting the row but it was abruptly not happening...

The reason was the data, I was inserting was crossing the limit of max value of that column by that reason insert statement was not happening.

Then I truncate some length of that field then it works fine.

So just cross check whether the data you are trying to insert is not more then specified length of the Table's column.

Hope it helps you.

 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you are not inserting NULL.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!