Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JDBC Transaction Problem

Posted on 2004-10-10
1
Medium Priority
?
480 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 400 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

704 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