error code [17027]; 流已被關閉;

鬱悶了很久,在剛開始使用mybatis的時候,插入語句沒有問題,可是有一個查詢語句有問題,死活找不到緣由,而且報如下錯誤,折騰了好幾個小時,最終得知須要把Oracle數據庫中的Long型的字段修改成Number,這樣才能夠正確的執行,汗!!!!java

歸結到底仍是對Oracle數字段類型沒有進入深刻了解,覺得Oracle中的long就是Java中的long,實際上若是是數字類型,最好 設置爲number類型,Oracle中的long類型不要使用spring

long:可變字符序列,最大長度爲2GB,用於不須要做字符串搜索的長串數據,若是要進行字符搜索就要用varchar2類型。long是一種比較老的數據類型,未來會主鍵被BLOB,CLOB,NCLOB等大的數據對象所取代

org.springframework.jdbc.UncategorizedSQLException: SqlSession operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17027]; 流已被關閉; nested exception is java.sql.SQLException: 流已被關閉
    at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
    at org.mybatis.spring.SqlSessionTemplate.wrapException(SqlSessionTemplate.java:364)
    at org.mybatis.spring.SqlSessionTemplate$7$1.doInSqlSession(SqlSessionTemplate.java:344)
    at org.mybatis.spring.SqlSessionTemplate.execute(SqlSessionTemplate.java:173)
    at org.mybatis.spring.SqlSessionTemplate.execute(SqlSessionTemplate.java:155)
    at org.mybatis.spring.SqlSessionTemplate$7.invoke(SqlSessionTemplate.java:339)
    at $Proxy9.queryById(Unknown Source)
    at com.sinosig.insurance.service.impl.DayAwardInfoServiceImp.queryById(DayAwardInfoServiceImp.java:18)
    at com.sinosig.insurance.test.TestMyBatis.Test(TestMyBatis.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:198)
    at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:274)
    at org.springframework.test.context.junit4.SpringMethodRoadie$2.run(SpringMethodRoadie.java:207)
    at org.springframework.test.context.junit4.SpringMethodRoadie.runBeforesThenTestThenAfters(SpringMethodRoadie.java:254)
    at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:234)
    at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:204)
    at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:146)
    at org.springframework.test.context.junit4.SpringJUnit4Cla***unner.invokeTestMethod(SpringJUnit4Cla***unner.java:151)
    at org.junit.internal.runners.JUnit4Cla***unner.runMethods(JUnit4Cla***unner.java:51)
    at org.junit.internal.runners.JUnit4Cla***unner$1.run(JUnit4Cla***unner.java:44)
    at org.junit.internal.runners.Cla***oadie.runUnprotected(Cla***oadie.java:27)
    at org.junit.internal.runners.Cla***oadie.runProtected(Cla***oadie.java:37)
    at org.junit.internal.runners.JUnit4Cla***unner.run(JUnit4Cla***unner.java:42)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.sql.SQLException: 流已被關閉
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
    at oracle.jdbc.driver.LongAccessor.getBytes(LongAccessor.java:150)
    at oracle.jdbc.driver.LongAccessor.getString(LongAccessor.java:192)
    at oracle.jdbc.driver.T4CLongAccessor.getString(T4CLongAccessor.java:421)
    at oracle.jdbc.driver.CharCommonAccessor.getLong(CharCommonAccessor.java:234)
    at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:551)
    at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1574)
    at org.apache.commons.dbcp.DelegatingResultSet.getLong(DelegatingResultSet.java:240)
    at org.apache.ibatis.type.LongTypeHandler.getNullableResult(LongTypeHandler.java:17)
    at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:29)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.applyAutomaticMappings(FastResultSetHandler.java:280)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.getRowValue(FastResultSetHandler.java:222)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleRowValues(FastResultSetHandler.java:173)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSet(FastResultSetHandler.java:146)
    at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:112)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:40)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:238)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:112)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:78)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:72)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:38)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:38)
    at $Proxy9.queryById(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.mybatis.spring.SqlSessionTemplate$7$1.doInSqlSession(SqlSessionTemplate.java:342)
    ... 29 more

 sql

相關文章
相關標籤/搜索