Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caused by: java.sql.SQLException: Closed Connection

 
Jigs Gohil
Greenhorn
Posts: 6
Eclipse IDE jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my Hibernate Configuration file....


1) Kindly tell me which other properties do i need to configure to avoid this Exceprion...which comes daily in the morning forcing me to restart the server(weblogic 10.3)....???

2) Do I need to configure it in the Hibernate.cfg... OR it is better to create a JNDI using weblogic console....???
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its always best to have a connection pool (preferably from a data source).. hibernate is not very good at managing connections (especially in a production environment).

you can use c3p0 (jar files comes with hibernate) for connection pooling if you can't create a datasource.

also if both the above options are not fesiable then try reading the following.

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html (read section 3.4: optional configuration properties)

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/architecture.html#architecture-current-session
 
Jigs Gohil
Greenhorn
Posts: 6
Eclipse IDE jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anantha...
I have created the DataSource in the weblogic...(Production Mode)
But after doing that I faced two Problems....
1) with CLOB data weblogic wrapped the result and returned it....so I have to typecast it with weblogic CLOB instead of sql CLOB...thus writing the App Server dependent code....
any alternative for this...?
2) I am having procedure doing following 2 things... i ) inserts data into Global Temporary Table (Oracle) ii) Opens a Cursor which fetches the data from the same table...
Now the problem is..When I am Using Hibernate Configuration for Connection Parameters .. the proc works absolutely fine i.e the cursor opens with correct data....
But when I use DataSource... the Proc doesn't return anything...i.e the cursor contains zero rows...

Any Idea what could the Problem....?
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to map the content as string not as a clop in hibernate... the documentation (links) has a sample program which cases a CLOB into a string...

that is the solution..


regarding the hibernate connection configuration & datasource... you need to make sure that the transaction manger used with the datasource is the correct one...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic