• 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

SQLException. Generel Error

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a PreparedStatement in my servlet which can INSERT a record into a MS Access database.
PreparedStatement.executeUpdate() method throws SQLException.Generel error, when it tries to INSERT a record to the database when the database is not empty. It can only insert the record when the database (table in MS Access) has no record.
Any clue?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you INSERTing the same record and thus breaking any unique key criteria ?
What extra info do you get with the SQLException ? If you are using the JDBC-ODBC Bridge you can switch ODBC Tracing on (via the ODBC Administrator in Control Panel for that ODBC DSN).
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about a little code and your stack trace. Might be able to help a little more!
 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MS ACCESS doesn't support PreparedStatements I got this information from PURE JAVA 2 by Kenneth Litwak. Using them will most likely produce the errors your getting. If ACCESS is all you have available then I would suggest getting a more full featured DBMS. I can suggest a very nice one called HypersonicSQL. Its a pure java dbms and is very fast.
Here is the link:
http://hsql.oron.ch/
Its also an open source project.
Have fun,
Frank

[This message has been edited by Frank Hale (edited June 02, 2000).]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i remember correctly, i have used preparedStatement to exe cute Queries in an MS-Access Database.
If you could send a stack trace of the error, this could help in a better suggestion.
I think you might have opened the particular table in your MS-Access GUI, before executing this query. Close all the tables from the MS-Access GUI and then try executing your application. Do reply if this works.
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pure Java 2 published by Sams says that MS Access doesn't support PreparedStatements, I'm not going to argue the point. Maybe your using Access 2000 which does? Who knows. I don't personnally use Access.
Frank
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well access doesn't support prepared statement
it treats it just like a statement call that is it is not precompiled sql but has to be compiled every time it is called thus negating the advantage of prepared statement
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sabbir
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, which you agreed to when you registered, 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 log in with a new name which meets the requirements.
Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic