• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Insert

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm struggling with inserting a record to Access 97 database.
The java program should insert one record into a table in a Access database which is allowed to read and write. I set up ODBC in the control panel->Data Sources(ODBC). The program seems working. However, it doesn't insert the record into that table. Strangely, when I use the same program, just change DSN to another database, it works fine. I just cannot think a reason which might cause the problem.
many thanks,

wendy
[ Edited by Dave to format code and remove smilies ]
[ December 09, 2002: Message edited by: David O'Meara ]
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got your email message over the weekend but could not respond. I have a couple of suggestion:
1) Have you thought about adding arguments to you connect statement?
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

I have not been able to get even read access to an Access DB without the arguments! It might be because I am using 1.3.1?!?!?
2) How about a new driver? For Access that is.
I hope this helps.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"wenting",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a known bug of with Access 97. For the new record to show in the access database, do a trivial select on the table you inserted into after you complete the insert or close the connection. It's not your code I think you can also upgrade your access ODBC driver.
Also, you might want to have a connection.commit() because all drivers don't default to autocommit = true.
Jamie
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic