用Ibatis联接数据库。
ibatis2.3.jar;
sql2000;
myeclipse7.0
问题描述:
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC
"-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<properties resource="jdbc.properties" />
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<typeAlias alias="person" type="com.ecp.ibatis.java.Person" />
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${jdbc.driver}" />
<property name="JDBC.ConnectionURL" value="${jdbc.url}" />
<property name="JDBC.Username" value="${jdbc.user}" />
<property name="JDBC.Password" value="${jdbc.password}" />
</dataSource>
</transactionManager>
<sqlMap resource="com/ecp/ibatis/map/Person_SqlMap.xml" />
</sqlMapConfig>
person_SqlMap.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="Person">
<resultMap id="person" class="com.ecp.ibatis.java.Person">
<!--
WARNING - This element is automatically generated by Abator for iBATIS, do not modify.
This element was generated on Fri Mar 20 15:38:16 CST 2009.
-->
<result column="PER_ID" property="perId" jdbcType="NUMERIC"/>
<result column="PER_FIRSTNAME" property="perFirstname" jdbcType="VARCHAR"/>
<result column="PER_LASTNAME" property="perLastname" jdbcType="VARCHAR"/>
<result column="PER_BIRTHDAY" property="perBirthday" jdbcType="TIMESTAMP"/>
<result column="PER_WEIGTH_KG" property="perWeigthKg" jdbcType="NUMERIC"/>
<result column="PER_HEIGHT_M" property="perHeightM" jdbcType="NUMERIC"/>
</resultMap>
<select id="getPerson" resultMap="person" parameterClass="java.lang.Integer">
<!--
WARNING - This element is automatically generated by Abator for iBATIS, do not modify.
This element was generated on Fri Mar 20 15:38:16 CST 2009.
-->
select PER_ID, PER_FIRSTNAME, PER_LASTNAME, PER_BIRTHDAY, PER_WEIGTH_KG, PER_HEIGHT_M
from Person
where PER_ID = #perId:NUMERIC#
</select>
</sqlMap>
别外有一个 Person.java
一些SET,GET属性
jdbc.properties
jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc.url=jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=ecp
jdbc.user=sa
jdbc.password=123456
联接数据库时,报出以下异常。
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/ecp/ibatis/map/Person_SqlMap.xml.
--- The error occurred while applying a result map.
--- Check the Person.person.
--- The error happened while setting a property on the result object.
--- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:83)
at com.ecp.ibatis.main.Test.main(Test.java:21)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseImplDatabaseMetaData.getImplConnection(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplDatabaseMetaData.processServerInfo(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplDatabaseMetaData.initializeNonResultSetMetaData(Unknown Source)
at com.microsoft.jdbc.base.BaseDatabaseMetaData.supportsMultipleResultSets(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.moveToNextResultsSafely(SqlExecutor.java:354)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:326)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 6 more
Exception in thread "main"
通过搜索网上各位的解决方法。
参考请见
http://blog.csdn.net/sunyujia/archive/2008/07/13/2646030.aspx
改动
jdbc.properties
中的.url
jdbc.url=jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=ecp
变为
jdbc.url=jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=ecp;selectMethod=cursor
分享到:
相关推荐
例如,在手动事务模式下尝试克隆连接可能会导致异常,如文中提到的“Can't start a cloned connection while in manual transaction mode”。 - **问题原因**:在手动事务模式下,如果尝试克隆连接,会导致这种类型...
Removing Credentials from a Cloned EBS Production Database (Doc ID 419475.1)
RFID(射频识别)技术是无线通讯技术的一种,它可以用于追踪和识别物理对象。RFID技术广泛应用于需要自动识别和追踪物品的场合,例如门禁控制、票据系统、支付处理、供应链管理和防伪等。在RFID系统中,标签被附着在...
In a web application, for instance, having a singleton database connection manager can help manage and control connections efficiently, ensuring that there's only one central authority for managing ...
The result is that both accounts have the same SID.Duplicate SIDs aren‘t an issue in a Domain-based environment since domain accounts have SID‘s based on the Domain SID. But, according to Microsoft...
- FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object....
a._setPaused=function(a){return createjs.Tween._register(this,a),this},a.setPaused=createjs.deprecate(a._setPaused,"AbstractTween.setPaused"),a._getPaused=function(){return this._paused},a.getPaused=...
A class of which only a single instance can exist Structural Patterns Adapter Match interfaces of different classes Bridge Separates an object’s interface from its implementation Composite A...
SA0033310 - Cloned connections don't always work correctly. SA0033327 - $$...$$ macro usage with SQL Server environments, in certain cases may trigger multiple executions of the same macro. SA...
- **Clone Types:** Types that implement the `Clone` trait can be cloned, creating a new owned value. - **Copy Types:** Types that implement the `Copy` trait can be copied directly into another ...
and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized ...
An effective and efficient assembly code clone search engine can greatly reduce the effort of this process, since it can identify the cloned parts that have been previously analyzed. The assembly ...
在讨论转基因克隆奶山羊中印记基因IGF2R表达与DNA甲基化状态的研究时,需要关注以下几个核心知识点: 1. 转基因技术与动物克隆:SCNT(体细胞核移植)是一种在转基因研究中应用于家畜的技术,该技术允许科学家将...
LFS是Large File Storage的缩写,用了帮助git管理大的文件 原理:不同于git每次保存diff,对于git来说,如果是模型或者一些设计大文件,改变一点,对于仓库来说会增加很大的体积,不一会就能几个G。...
You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements. * name: `String` — group name * pull: `true|false|'clone'|function` — ability to move from ...
Q492107 - A JPEG image loaded from a stream and then cloned by the TdxSmartImage.Clone method is incompletely painted by TdxSmartImage draw routines Q488736 - An AV occurs when closing an application ...
Q492107 - A JPEG image loaded from a stream and then cloned by the TdxSmartImage.Clone method is incompletely painted by TdxSmartImage draw routines Q488736 - An AV occurs when closing an application ...
Omit dependenciesnpm run build // Include dependencies多姆dom(selector) 返回与document selector匹配的元素数组( dom.query(selector, document)别名)。DOM节点根头身体观滚动的主要“视图”元素,是<...
3. Run npm install in cloned directory 4. Start MongoDB service in your machine 5. Change the connection string of DB in db/db.js 5. Start the app by running npm run dev and open POSTMAN. 6. Start ...
was set and the ESC key was pressed while a file on the local system was being renamed, SecureFX crashed. - Mac: On 10.7 (Lion), if the "FileTypes.ini" file needed to be created (e.g., when ...