connection problem with derby when I want to insert new log messages into database
Posted on 2011-02-17
I have a java application and I use Spring, Hibernate and embedded Derby database.
As I wanted to save my log messages into database, I defined a new Appender for log4j. When in the appendar I want to read from database or write into it I get an exception that the root cause is :
Caused by: java.sql.SQLException: No current connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
I guess the problem is with the Embedded Derby and its limitation for just one connection and It seems that appender can't use the same connection in my application(probably because it runs in another thread or something) and it want to get a new one and can't.
Any idea to solve this problem without using the network derby?