According to the javadocs autocommit is the default mode. http://java.sun.com/j2se/1.3/docs/api/java/sql/Connection.html#getAutoCommit ()
Is the int result returning a value? Also make sure that u are refreshing the DB. Closing the stmt after you use it is good habit and may solve your problem. If all else fails.. why rely on autocommit? just call commit(). if commit() doesnt work then you have other problems. -Tim -----Original Message----- From: Isidoros Vacropoulos [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 5:01 AM To: [EMAIL PROTECTED] Subject: Re: JDBC I don't know if this is the error but setting the autocommit mode to true/false MUST ocur before creating the statement, so your code must look like this: Connection con; // creates a reference for Connection Class Statement st=null; // creates a reference for Statement Class ResultSet rs; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // define the Driver con = DriverManager.getConnection("jdbc:odbc:"+dns,dnsName,dnsPassword); // Set the autocommit mode to true; con.setAutoCommit(true); //Get the Connection st = con.createStatement(); // Create Statement String sql = "Insert into Budget_Project_Definition values (12,{d \'2001-12-03\'})"; int result = st.executeUpdate(sql); System.out.println("A "+result); }catch(Exception e){ e.printStackTrace(); } -----Original Message----- From: Purav [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 5:07 PM To: [EMAIL PROTECTED] Subject: Re: JDBC Simple yaar. Print the sql statement on your page. Copy paste the query ino your query analyser and see the error for yourself Regards Purav Parekh -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]] On Behalf Of anoop Sent: Monday, December 03, 2001 6:22 PM To: [EMAIL PROTECTED] Subject: Re: JDBC first see if u can query from ur program..then u may go for updating and other complicated things.. regards, anoop ----- Original Message ----- From: "Nandish Angadi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 03, 2001 5:05 PM Subject: Re: JDBC at present i am using msaccess for testing and i am using JDBC-ODBC bridge creating a dsn from the control panel's "ODBC Data Source 32 bit" -----Original Message----- From: Raghupathy, Gurumoorthy [SMTP:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 5:03 PM To: [EMAIL PROTECTED] Subject: Re: JDBC hi, can you tell me which databaase you are using....? and what is the odbc configuration details... guru -----Original Message----- From: Nandish Angadi [mailto:[EMAIL PROTECTED]] Sent: 03 December 2001 11:26 To: [EMAIL PROTECTED] Subject: Re: JDBC Hi guru, i tried with placing setAutoCommit(true) at all the possible place but the result is same Regards -----Original Message----- From: Raghupathy, Gurumoorthy [SMTP:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 4:55 PM To: [EMAIL PROTECTED] Subject: Re: JDBC hi, is the autocommit set to off at the biggening? if yes .... then use con.setAutoCommit( true ) before you execute the sql... or use the commit statement to explicilty commit the transaction. guru -----Original Message----- From: Nandish Angadi [mailto:[EMAIL PROTECTED]] Sent: 03 December 2001 11:17 To: [EMAIL PROTECTED] Subject: JDBC Hi all, I have a table with four data/time fields in the table. I want to insert a row and i am using the sql command as "insert into table_name values ({d \'yyyy-mm-dd\'},{d \'yyyy-mm-dd\'},{d \'yyyy-mm-dd\'},{d \'yyyy-mm-dd\'})".I do not get a compile error nor a runntime error, but when i check the database row is not inserted. here is the code Connection con; // creates a reference for Connection Class Statement st=null; // creates a reference for Statement Class ResultSet rs; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // define the Driver con = DriverManager.getConnection("jdbc:odbc:"+dns,dnsName,dnsPassword); // Get the Connection st = con.createStatement(); // Create Statement String sql = "Insert into Budget_Project_Definition values (12,{d \'2001-12-03\'})"; int result = st.executeUpdate(sql); System.out.println("A "+result); con.setAutoCommit(true); }catch(Exception e){ e.printStackTrace(); } Thanks in advance Nandish ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ________________________________________________________________________ ___ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
