Link to home
Start Free TrialLog in
Avatar of KNVB HK
KNVB HKFlag for Hong Kong

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.microsoft.jdbc.sqlserver.SQLServerDriver");
        Connection dbConn=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.121:1433;SelectMode=cursor;DatabaseName=MyDb",strDbUser,strDbPassword);
        Statement stmt=dbConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
        dbConn.setAutoCommit(false);
        ResultSet rs=stmt.executeQuery("Select * from User_Table");
 rs.moveToInsertRow();
        rs.updateObject("userName","hello");
        rs.updateObject("UserLogName","hello");
        rs.updateObject("UserLogPWD","123456");
        rs.updateObject("UserStatus",new Integer(0));
        rs.updateObject("UserPendingPoints",new Integer(0));
        rs.updateObject("UserAwardedPoints",new Integer(0));
        rs.updateObject("UserTotalPoints",new Integer(0));
        rs.updateObject("UserEmail",new String("strUserEmail"));
        rs.updateObject("UserName",new String("strUserName"));
        rs.updateObject("UserLogPWD",new String("strUserPwd"));
        rs.updateObject("UserLogName",new String("strUserLogName")) ;
        rs.updateObject("UserAddress",new String("strUserAddress"));
        rs.updateObject("UserPhone",new String  ("strUserPhone"));
        rs.updateObject("UserMobile",new String("strUserMobile"));
        rs.insertRow();  
        dbConn.commit();  

Can anyone tell me how can I solve the problem?

thank you very much
ASKER CERTIFIED SOLUTION
Avatar of schubemk
schubemk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial