I have written a web service using JAX-WS in GlassFish. I get database connection from datasource and pass it to jOOQ.
Context context = new InitialContext();
DataSource dataSource = (DataSource) context.lookup("jdbc/datasrc");
Connection connection = dataSource.getConnection();
DSLContext create = DSL.using(connection, SQLDialect.MYSQL);
At the end of request(based on this question), I close connections with Apache DBUtils:
DbUtils.closeQuietly(connection);
The problem is I can only send one request. After that I get connection closed exception. Connection pool in GlassFish is configured with:
Transaction Isolation: read-commited
Isolation Level: Guaranteed
Resource Type: javax.sql.ConnectionPoolDataSource
Datasource Classname: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Am I closing physical connection? I'm using MySQL 5.5.32 on fedora 19 with GlassFish 4 build 89. Can anyone help?
[UPDATE]
I have downgraded to GlassFish 3.1.2.2 and the same code works just fine. Does connection pool behaviour changed in GlassFish 4?