Solved

JDBC Transaction Problem

Posted on 2004-10-10
1
478 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:cstsang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
schubemk earned 100 total points
ID: 12286138
In your dbconn= statement, you entered "SelectMode=cursor", it should be "SelectMethod=cursor" like this:

dbConn=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.121:1433;SelectMethod=cursor;DatabaseName=MyDb",strDbUser,strDbPassword);
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Gain an elementary understanding of Blockchain technology.
Popular third-party chat platforms like Slack, Discord, and Telegram are just a few of the many new productivity applications that are being hijacked by cybercriminals to create command-and-control (C&C) communications infrastructures for their malw…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question