Solved

JDBC Transaction Problem

Posted on 2004-10-10
1
476 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
trouble with PDF encryption using itext-1.3.1 17 88
J2SE 5.0 metadata 1 67
error when compiling my project in eclipse luna 30 506
IE doesn't Invoke servlet in iframe 1 123
Read the original post on Monitis Blog. Believe it or not, the most important thing about the website of your business is not what’s on it but how fast it loads. Yes, that’s right!    As you can see on this infographic (an oldie but goodie!), …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 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