各位大虾,小弟这两天为这个问题寝食难安。万恶的IBM。
websphere6.1+DB2 v9.1+ibatis2.3.4
配置文件如下:
sqlmapconfig.xml :
<sqlMapConfig>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.ibm.db2.jcc.DB2Driver"/>
<property name="JDBC.ConnectionURL" value="url"/>
<property name="JDBC.Username" value="username"/>
<property name="JDBC.Password" value="pwd"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/eclipselite/bank/memfis/mf/sqlmap/FundManager.xml"/>
</sqlMapConfig>
FundManager.xml:
<sqlMap namespace="MasterMaintenance">
<typeAlias alias="FundManager" type="com.eclipselite.bank.memfis.mf.maintenance.dom.ibatis.FundManagerDom"/>
<select id="getTotalNoOfFundManagers" parameterClass="FundManager" resultClass="int" >
SELECT count(1) FROM tables </select>
</sqlMap>
FundManagerDAO .java :
public class FundManagerDAO {
public static SqlMapClient sqlMap;
public static Map userNameMap = new HashMap();
static{
String internalException = null;
try {
Reader reader = Resources.getResourceAsReader("com/eclipselite/bank/memfis/mf/sqlmap/SqlMapConfig.xml");
sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
reader.close();
} catch (IOException e) {
e.printStackTrace();
internalException = e.toString();
}
if(sqlMap == null){
throw new RuntimeException("Something bad happened while building the sqlMapperSpain instance." , new Exception(internalException));
}
}
public static void main(String[] args){
try {
System.out.println(getTotalNoOfFundManagers(null)) ;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static int getTotalNoOfFundManagers(FundManagerDom dom) throws SQLException {
Date beginDate = new Date();
int i = 0;
try {
sqlMap.startTransaction();
i = (int)MemfisGenUtility.checkInteger(sqlMap.queryForObject("getTotalNoOfFundManagers",dom));
} catch (SQLException e) {
e.printStackTrace();
throw e;
}finally{
try {
sqlMap.commitTransaction();
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
try {
sqlMap.endTransaction();
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
}
return i;
}
public List getFundManagers(FundManagerDom fmDom) throws SQLException {
int pageNo = fmDom.getPageNo();
Date beginDate = new Date();
List list;
try{
sqlMap.startTransaction();
list = this.sqlMap.queryForList("getFundManagers",fmDom, (pageNo-1)*30, 30);
sqlMap.commitTransaction();
}catch (SQLException e) {
e.printStackTrace();
throw e;
}finally{
try {
sqlMap.commitTransaction();
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
try {
sqlMap.endTransaction();
} catch (SQLException e) {
e.printStackTrace();
throw e;
}
}
return list;
}
}
小弟单独DEBUG运行 木友问题 可以查出条数,但是部署在websphere6。1 之后就报如下错误:
Error Description |
com.eclipselite.bank.memfis.common.util.MemfisException : com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/eclipselite/bank/memfis/mf/sqlmap/FundManager.xml. --- The error occurred while applying a result map. --- Check the getTotalNoOfFundManagers-AutoResultMap. --- Check the result mapping for the ‘1’ property. --- Cause: com.ibm.db2.jcc.a.SqlException: DatabaseMetaData information is not known for server DB2DSN09015 by this version of JDBC driver
.
渴求各位大拿,感激不尽。
|