Hi everyone, Can someone give me an example of how to connect to SQL Server 2000 using Java and do an 'insert' and be able to access the data from the SQL Server Query Analyser. I have done several programs which are compiling with no errors but then when I go to check for the results I am findind nothing. Please help...
You need setString(1,...), setString(2,...), setString(3, ...) etc. At the moment they are 1,2,1,1,1 etc so you are overwriting the first parameter. I usually do this with an increment so that I can add/remove and re-order attributes without having to redo the indicies constantly.
There's a bug in either the JDBC-ODBC bridge or Access (not sure which, I'm assuming the bridge) where inserts are not You can do a search in this forum for other solutions, but you can do these things: Firstly, explicitly commit your transactions. Secondly, perform a small select on the same connection. I've never had the problem, but I've heard these steps can provide a solution. Dave.
We need more information on the exception thrown. Change your catch block to the following:
let us know what the error message is. About David's suggestion to "Secondly, perform a small select on the same connection." I'm sure this is an access only problem (Access ODBC driver). Never seen it on anything other than MSAccess. Jamie