aspose file tools*
The moose likes JDBC and the fly likes Last record is not inserted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Last record is not inserted" Watch "Last record is not inserted" New topic
Author

Last record is not inserted

ganapathy gopinathan
Ranch Hand

Joined: Aug 10, 2004
Posts: 30
Hi wagner,

Thank u 4 ur response.

In my code i m not using the loop.i just tried to insert only one record. while i was doing so, i got no errors. and the record was not inserted. but when i tried with the 2 records using separate 'insert' command it was working.

ganapathy gopinathan
Ranch Hand

Joined: Aug 10, 2004
Posts: 30
When i inserted 2 records, i could not insert the last one(second one).
when i inserted 3 records, i could not insert the last one( third one).
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

can you paste loop part of your code


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
PJ Crump
Ranch Hand

Joined: Feb 06, 2002
Posts: 51
Did you do a commit after the inserts? If not, you need to.
ganapathy gopinathan
Ranch Hand

Joined: Aug 10, 2004
Posts: 30
Hi crump,

Thank u for ur response. but i tried with that it is not working.

when i just tried to do insert, this happens.

when i tried to insert and read the records from the same table it is working. i dont know y???

regards
gopi
[ September 29, 2004: Message edited by: ganapathy gopinathan ]
ganapathy gopinathan
Ranch Hand

Joined: Aug 10, 2004
Posts: 30
Hi Chandra,

Here is my code,




This is working fine in my friend's system, but i m getting this problem while i m working in my system.

Thank u
gopinathan
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Try executeUpdate()


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Translation:
u = you
ur = you are, you're
4 = for
y = why
i m = I'm
Please don't be lazy. Contractions make posts harder to read. Are large proportion of JavaRanch users don't have English as their first language, so combining contractions with spelling and grammar errors just serves to make communication harder when we should be trying to make it easier. Thanks.

Please give us more information. If you are using MS Access and the JDBC-ODBC bridge, this is a common problem, you'll find several hundred threads discussing it in this forum. The simple solution is either set autoCommit to true or do a 'dummy read' to flush the connection.
ganapathy gopinathan
Ranch Hand

Joined: Aug 10, 2004
Posts: 30
Sorry for the inconvenience, near after i will follow your request.

yes, i am using JDBC-ODBC driver with MS-ACCESS.

Is the problem in the MS-ACCESS or in JDBC-ODBC?
where i have to use the 'autocommit'?
Is it in MS-ACCESS or in my coding?


Thank you,
gopinathan
[ September 30, 2004: Message edited by: ganapathy gopinathan ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

No problem.

I believe the issue is caused by the JDBC-ODBC driver. It was only designed as a quick fix to bridge the gap between the two technologies and has outgrown its purpose. It was never meant for production systems and has greater issues than this one!

It appears the driver caches queries and needs 'one more request' to make sure the previous one gets flushed, hence the 'dummy select' at the end. Presonally I always set the auto commit, but then I try not to use Access anyway.

I hope your problem is fixed.
Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Last record is not inserted