You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Will Glass-Husain <wg...@forio.com> on 2002/03/28 18:52:01 UTC

MS SQL Server - JDBC driver exception

Hi,

I'm struggling with MS SQL Server, using Torque (standalone), with the MS
JDBC driver.  I've done my due diligence, reading the 2 or 3 threads with
MSSQL tips on the mailing list (and the MS SQL notes on the web site).

Anyone come across the following issue?  I can't seem to update a record in
the database without getting an exception from the JDBC driver "Can't start
a cloned connection while in manual transaction mode".

Here's an excerpt from my log, the code that's generating the message, and
the XML schema.  I'm a little bit of a novice with MS SQL, so any ideas for
investigation would be appreciated!

WILL


LOG:

03-28 08:48 DEBUG - SELECT tblEmpInfo.INTID, tblEmpInfo.INTSIM_SESSION_ID,
tblEmpInfo.SZUSER_ID, tblEmpInfo.SZLASTNAME_NM, tblEmpInfo.SZFIRSTNAME_NM,
tblEmpInfo.SMINIT_NM, tblEmpInfo.SNICKNAME_NM, tblEmpInfo.SZEMAIL FROM
tblEmpInfo WHERE (tblEmpInfo.SZUSER_ID='t1')
03-28 08:48 DEBUG - Elapsed time=0.031 secs
03-28 08:48 DEBUG - BasePeer.doUpdate: whereClause=INTID=1
03-28 08:48 ERROR - Couldn't save user login information.
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Can't start a
cloned connection while in manual transaction mode.

CODE:
		try {
			String testuserid = "t1";

			Criteria crit = new Criteria();
			crit.add(UserPeer.SZUSER_ID,new StringKey(testuserid ));
			Vector UserList = UserPeer.doSelect(crit);
			if (UserList.size() == 0) {
				log.error("Invalid user id!");

			} else {
				User TheUser = (User) UserList.get(0);
				TheUser.setSimSessionId(RandInt);
				TheUser.save();
				log.info("Logged user " + userid + " in.");
			}
		} catch (Exception E) {
			log.error("Couldn't save user login information.  " + E);
		}


SCHEMA XML EXCERPT:

   <!-- ===================================================== -->
   <table name="tblEmpInfo" javaName="User" idMethod="none" skipSql="true"
        description="OM representation of previously created table."

   >
        <column name="intID" required="true"  javaName="Id"
primaryKey="true" type="INTEGER" />
        <column name="intSIM_SESSION_ID"   javaName="SimSessionId"
required="true" default="-1" type="INTEGER" />
        <column name="szUser_ID" javaName="UserId" required="true" size="8"
type="VARCHAR" />
        <column name="szLastName_nm"  javaName ="LastName"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="szFirstName_nm" javaName ="FirstName" size="255"
default="" required="true" type="VARCHAR"/>
        <column name="sMInit_nm"  javaName ="MInitial"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="sNickName_nm"  javaName ="NickName"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="szEmail"     javaName ="Email"     size="255"
default="" required="true" type="VARCHAR"/>


    </table>

_______________________________________
Forio Business Simulations
Will Glass-Husain
(415) 440-7500 phone
(415) 235-4293 mobile
wglass@forio.com
www.forio.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: MS SQL Server - JDBC driver exception

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Will Glass-Husain" <wg...@forio.com> writes:

> Hi,
>
> Just to answer my own question, I discovered that with the Microsoft JDBC
> driver, you need to add a "SelectMethod=cursor" property.
>
> torque.database.default=mydb
> torque.database.mydb.driver =  com.microsoft.jdbc.sqlserver.SQLServerDriver
> torque.database.mydb.url =
> jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cur
> sor
> torque.database.mydb.username=dbuser
> torque.database.mydb.password=
>
> http://forum.java.sun.com/thread.jsp?forum=48&thread=184797
>
> Might be helpful if this is added to the "How-To" MS SQL document.
>
> Had another difficulty (I solved it) before getting this up and running--
> I'll post it in a new message for the benefit of the archive.

Thanks Will, done.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: MS SQL Server - JDBC driver exception

Posted by Will Glass-Husain <wg...@forio.com>.
Hi,

Just to answer my own question, I discovered that with the Microsoft JDBC
driver, you need to add a "SelectMethod=cursor" property.

torque.database.default=mydb
torque.database.mydb.driver =  com.microsoft.jdbc.sqlserver.SQLServerDriver
torque.database.mydb.url =
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cur
sor
torque.database.mydb.username=dbuser
torque.database.mydb.password=

http://forum.java.sun.com/thread.jsp?forum=48&thread=184797

Might be helpful if this is added to the "How-To" MS SQL document.

Had another difficulty (I solved it) before getting this up and running--
I'll post it in a new message for the benefit of the archive.

WILL



-----Original Message-----
From: Will Glass-Husain [mailto:wglass@forio.com]
Sent: Thursday, March 28, 2002 9:52 AM
To: turbine-user@jakarta.apache.org
Subject: MS SQL Server - JDBC driver exception


Hi,

I'm struggling with MS SQL Server, using Torque (standalone), with the MS
JDBC driver.  I've done my due diligence, reading the 2 or 3 threads with
MSSQL tips on the mailing list (and the MS SQL notes on the web site).

Anyone come across the following issue?  I can't seem to update a record in
the database without getting an exception from the JDBC driver "Can't start
a cloned connection while in manual transaction mode".

Here's an excerpt from my log, the code that's generating the message, and
the XML schema.  I'm a little bit of a novice with MS SQL, so any ideas for
investigation would be appreciated!

WILL


LOG:

03-28 08:48 DEBUG - SELECT tblEmpInfo.INTID, tblEmpInfo.INTSIM_SESSION_ID,
tblEmpInfo.SZUSER_ID, tblEmpInfo.SZLASTNAME_NM, tblEmpInfo.SZFIRSTNAME_NM,
tblEmpInfo.SMINIT_NM, tblEmpInfo.SNICKNAME_NM, tblEmpInfo.SZEMAIL FROM
tblEmpInfo WHERE (tblEmpInfo.SZUSER_ID='t1')
03-28 08:48 DEBUG - Elapsed time=0.031 secs
03-28 08:48 DEBUG - BasePeer.doUpdate: whereClause=INTID=1
03-28 08:48 ERROR - Couldn't save user login information.
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Can't start a
cloned connection while in manual transaction mode.

CODE:
		try {
			String testuserid = "t1";

			Criteria crit = new Criteria();
			crit.add(UserPeer.SZUSER_ID,new StringKey(testuserid ));
			Vector UserList = UserPeer.doSelect(crit);
			if (UserList.size() == 0) {
				log.error("Invalid user id!");

			} else {
				User TheUser = (User) UserList.get(0);
				TheUser.setSimSessionId(RandInt);
				TheUser.save();
				log.info("Logged user " + userid + " in.");
			}
		} catch (Exception E) {
			log.error("Couldn't save user login information.  " + E);
		}


SCHEMA XML EXCERPT:

   <!-- ===================================================== -->
   <table name="tblEmpInfo" javaName="User" idMethod="none" skipSql="true"
        description="OM representation of previously created table."

   >
        <column name="intID" required="true"  javaName="Id"
primaryKey="true" type="INTEGER" />
        <column name="intSIM_SESSION_ID"   javaName="SimSessionId"
required="true" default="-1" type="INTEGER" />
        <column name="szUser_ID" javaName="UserId" required="true" size="8"
type="VARCHAR" />
        <column name="szLastName_nm"  javaName ="LastName"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="szFirstName_nm" javaName ="FirstName" size="255"
default="" required="true" type="VARCHAR"/>
        <column name="sMInit_nm"  javaName ="MInitial"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="sNickName_nm"  javaName ="NickName"  size="255"
default="" required="true" type="VARCHAR"/>
        <column name="szEmail"     javaName ="Email"     size="255"
default="" required="true" type="VARCHAR"/>


    </table>

_______________________________________
Forio Business Simulations
Will Glass-Husain
(415) 440-7500 phone
(415) 235-4293 mobile
wglass@forio.com
www.forio.com


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>