• 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

Access Database

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have connected to my database in access.I am able to retrieve(select * from table) is working.

ResultSet rs = null;
Statement stmt= null;
Connection connection = getConnection();
stmt = connection.createStatement();
rs = stmt.executeQuery("select * from table");



when i do update or insert, I am not getting any error messages but
execute(query) returns false and executeUpdate returns 1 ??


ResultSet rs = null;
Statement stmt= null;
Connection connection = getConnection();
stmt = connection.createStatement();
rs = stmt.execute("insert" or "update" or "delete");

Please help me.
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Pree Sree!!
there are some drawbacks for the MS Access Database!!
u can select using the execute(query)
but when u try to insert use the Prepared Statement!! ok

we can insert.. delete using PreparedStatement!!
select work in execute()

i'm not sure abt the update table statement.. in msaccess..
i tried it long back!!

but when i tried it in oracle..
every query is running perfectly!!

try the prepared statement!!
if u have any doubts ..
send reply.. will help u!!
thanks
regards!!

Aravind
 
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
Aravind, please use real words and try not to use abreviations. These make your posts hard to understand.

Pree, there is a bug in the JDBC-ODBC bridge where it does not always commit operations to the databases. Three common solutions are:
1) setAutoCommit(true) on the connection or
2) do a dummy select after insert/update/delete operations eg "select * from user where userid=1". This will cause the previous operation to go through.
3) Don't use Access
 
reply
    Bookmark Topic Watch Topic
  • New Topic