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.
There is a bug in the jdbc-odbc bridge. Try running a select on the same connection then see if the insert went through.
Joined: Nov 28, 2010
David O'Meara wrote:There is a bug in the jdbc-odbc bridge. Try running a select on the same connection then see if the insert went through.
I dont understand...
This code: String sql="INSERT INTO RECIPESTABLE(RECIPENAME,INGREDIENTS)"+"VALUES('"+ fristName + "','Ingredients')"; is insert value
all work good the Eclipse run it....
If I change the code like that:"INSERT INTO RECIPESTABLE(RECIPENAME,INGREDIENTS)"+"VALUES('Pizza ','Ingredients')"; is insert value pizza and I want when you Enter your name it insert your name
and i dont know how to change this code for that this will run.
I'd recommend getting rid of access and trying to use a real database like MySQL with the Type 4 driver.
Failing that, I recommend doing this for your insert:
* get connection
* get statement for insert
* execute insert
* close statement
* get statement for select
* execute select, close ResultSet, close Statement
* close Connection
While you just throw out the results from the select, it is required to 'push' the insert statement through the Type-1 driver since due to a bug it can get stuck.
Another option is to setAutocommit(true) when you open a database Connection
Your code doesn't appear to close database resources when it is done with them, and this can also be the source of errors.