Meaningless Drivel is fun!
The moose likes Object Relational Mapping and the fly likes Error in Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Error in Hibernate " Watch "Error in Hibernate " New topic

Error in Hibernate

nisu pathak

Joined: Nov 03, 2013
Posts: 29
hello friends i want to implement hibenate managed connection pooling usign C3P0.i can't be able to establish connection to derby database.i am pasting my code here :

i simply want to persist Employee Data

at ij client i am executing this command : connect jdbc:derby:MyDb is it appropriate .here i am not defining port(1527) as per Derby Documentation it is correct ?
i am getting following error:
log4j:WARN No appenders could be found for logger (org.hibernate.type.BasicTypeRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See for more info.
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
at org.hibernate.exception.SQLStateConverter.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.exception.JDBCExceptionHelper.convert(
at org.hibernate.jdbc.ConnectionManager.openConnection(
at org.hibernate.jdbc.ConnectionManager.getConnection(
at org.hibernate.jdbc.JDBCContext.connection(
at org.hibernate.transaction.JDBCTransaction.begin(
at org.hibernate.impl.SessionImpl.beginTransaction(
at org.Model.Client.main(
Caused by: java.sql.SQLException: Database 'myDb' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.Driver20.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(
at org.hibernate.jdbc.ConnectionManager.openConnection(
... 5 more
Caused by: java.sql.SQLException: Database 'myDb' not found.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
... 21 more
Lex Lopez

Joined: May 08, 2014
Posts: 1
I'm dealing with the same issue here, I removed the c3p0 configuration from the Hibernate.xml and works without the c3p0 pooling by default, reading I realized that c3p0 is actually the best option for pooling, but somehow we need a different configuration to make it work with hibernate and derby.
I haven't been able to solve it, by now I'm working without c3p0 on the server side code, but eventually I will need it to connect the client, so, did you solve it? share please.
I agree. Here's the link:
subject: Error in Hibernate
jQuery in Action, 3rd edition