KNVB HK
asked on
JDBC Transaction Problem
I got the following error message when I trying to insert a row to database.
[Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
Here is my code:
Class.forName("com.microso ft.jdbc.sq lserver.SQ LServerDri ver");
Connection dbConn=DriverManager.getCo nnection(" jdbc:micro soft:sqlse rver://192 .168.0.121 :1433;Sele ctMode=cur sor;Databa seName=MyD b",strDbUs er,strDbPa ssword);
Statement stmt=dbConn.createStatemen t(ResultSe t.TYPE_SCR OLL_INSENS ITIVE,Resu ltSet.CONC UR_UPDATAB LE);
dbConn.setAutoCommit(false );
ResultSet rs=stmt.executeQuery("Sele ct * from User_Table");
rs.moveToInsertRow();
rs.updateObject("userName" ,"hello");
rs.updateObject("UserLogNa me","hello ");
rs.updateObject("UserLogPW D","123456 ");
rs.updateObject("UserStatu s",new Integer(0));
rs.updateObject("UserPendi ngPoints", new Integer(0));
rs.updateObject("UserAward edPoints", new Integer(0));
rs.updateObject("UserTotal Points",ne w Integer(0));
rs.updateObject("UserEmail ",new String("strUserEmail"));
rs.updateObject("UserName" ,new String("strUserName"));
rs.updateObject("UserLogPW D",new String("strUserPwd"));
rs.updateObject("UserLogNa me",new String("strUserLogName")) ;
rs.updateObject("UserAddre ss",new String("strUserAddress"));
rs.updateObject("UserPhone ",new String ("strUserPhone"));
rs.updateObject("UserMobil e",new String("strUserMobile"));
rs.insertRow();
dbConn.commit();
Can anyone tell me how can I solve the problem?
thank you very much
[Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
Here is my code:
Class.forName("com.microso
Connection dbConn=DriverManager.getCo
Statement stmt=dbConn.createStatemen
dbConn.setAutoCommit(false
ResultSet rs=stmt.executeQuery("Sele
rs.moveToInsertRow();
rs.updateObject("userName"
rs.updateObject("UserLogNa
rs.updateObject("UserLogPW
rs.updateObject("UserStatu
rs.updateObject("UserPendi
rs.updateObject("UserAward
rs.updateObject("UserTotal
rs.updateObject("UserEmail
rs.updateObject("UserName"
rs.updateObject("UserLogPW
rs.updateObject("UserLogNa
rs.updateObject("UserAddre
rs.updateObject("UserPhone
rs.updateObject("UserMobil
rs.insertRow();
dbConn.commit();
Can anyone tell me how can I solve the problem?
thank you very much
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.