This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?
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).
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).]
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.
Joined: Mar 25, 2000
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
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
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.