Hi,all
I connected MSsql server with type4 jdbc driver.
I want to execute two update statement in a transaction.the code as below:
..............................
dbCon.setAutoCommit(false);
strSql="update ms_empType set type_desc=?
,salary_type=?,prob_after=?,prob_unit=?,"+
"fix_work_day=?,pay_code=?,base_inc=?,inc_ot=? ,emp_type=? where
emp_Type=?";
PreparedStatement pstmt3=dbCon.prepareStatement(strSql) ;
pstmt3.setString(1,typeDesc) ;
pstmt3.setString(2,salaryType) ;
pstmt3.setInt(3,probAft) ;
pstmt3.setString(4,probUnit);
pstmt3.setFloat(5,fwd);
pstmt3.setString(6,payCode) ;
pstmt3.setFloat(7,baseInc) ;
pstmt3.setString(8,incOt);
pstmt3.setString(9,"iv") ;
pstmt3.setString(10,oEmpType) ;
pstmt3.executeUpdate() ;
pstmt3.close() ;
strSql="update ms_empType set type_desc=?
,salary_type=?,prob_after=?,prob_unit=?,"+
"fix_work_day=?,pay_code=?,base_inc=?,inc_ot=? ,emp_type=? where
emp_Type=?";
PreparedStatement pstmt2=dbCon.prepareStatement(strSql) ;
pstmt2.setString(1,typeDesc) ;
pstmt2.setString(2,salaryType) ;
pstmt2.setInt(3,probAft) ;
pstmt2.setString(4,probUnit);
pstmt2.setFloat(5,fwd);
pstmt2.setString(6,payCode) ;
pstmt2.setFloat(7,baseInc) ;
pstmt2.setString(8,incOt);
pstmt2.setString(9,empType) ;
pstmt2.setString(10,oEmpType) ;
pstmt2.executeUpdate() ;
pstmt2.close() ;
dbCon.commit() ;
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
but when i run the jsp includes this code,it throw an error:
[JDBC SQL Server Driver] Only one statement is allowed in transaction mode.
if ,as it said,a transaction can't include above one statement,how can i do
to control transaction?
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets