Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

How to getConnection in the mybatis&spring development environment? #568

Closed
GoogleCodeExporter opened this issue Apr 21, 2015 · 4 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What version of the MyBatis are you using?
==>3.1.0

Please describe the problem.  Unit tests are best!
==>In my web app, i want to use stored procedures whose input parameter is 
oracle.sql.ARRAY. So i have to get the underlying connection.At first, i 
extended SqlSessionDaoSupport and use 
"super.getSqlSession().getConnection().getMetaData().getConnection()" to get 
the connection.The unit test is ok, but when i called the service from web, I 
got the sql exception.

What is the expected output? What do you see instead?


Can you provide stack trace, logs, error messages that are displayed?
==>java.sql.SQLException: Connection is closed.
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.checkOpen(PoolingDataSource.java:175)
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getMetaData(PoolingDataSource.java:233)

Please provide any additional information below.

Original issue reported on code.google.com by hillfall...@gmail.com on 28 Mar 2012 at 2:45

@GoogleCodeExporter
Copy link
Author

my mybatis-spring version is 1.1.0

Original comment by hillfall...@gmail.com on 28 Mar 2012 at 2:48

@GoogleCodeExporter
Copy link
Author

oh i fixed it. my solution is  "@Autowired SqlSessionFactory 
sqlSessionFactory;" and 
"sqlSessionFactory.openSession().getConnection().getMetaData().getConnection();"

Original comment by hillfall...@gmail.com on 28 Mar 2012 at 5:03

@GoogleCodeExporter
Copy link
Author

good!

Original comment by eduardo.macarron on 28 Mar 2012 at 6:07

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

Original comment by eduardo.macarron on 4 Apr 2012 at 10:45

  • Removed labels: Version-Release3.x

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant