You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Avin <av...@yahoo.com> on 2006/04/30 00:26:05 UTC

Hibernate and Derby

I am gettin the following error, when I try to connect to Apache Derby using Hibernate. Can anyone let me know what this might be ???

    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] WARNING: SQL Error: -1, SQLState: 42Y07
    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] SEVERE: Schema 'SYSTEM' does not exist
    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] WARNING: SQL Error: -99999, SQLState: null
    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] SEVERE: java.sql.Connection.close() requested while a transaction is
in progress on the connection.The transaction remains active, and the connection
 cannot be closed.
    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] WARNING: SQL Error: -99999, SQLState: null
    [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
xceptions
    [java] SEVERE: java.sql.Connection.close() requested while a transaction is
in progress on the connection.The transaction remains active, and the connection
 cannot be closed.

		
---------------------------------
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Re: Hibernate and Derby

Posted by Avin <av...@yahoo.com>.
I finally figured out what was wrong. I was creating a DB with username: system , and I was trying to access the Embedded Derby DB in my code without any username password.

As a result of this, my code bombed at runtime !!

Thanks Jean for your suggestion...it helped me figure out what the problem was.

"Jean T. Anderson" <jt...@bristowhill.com> wrote: Avin wrote:
> I am gettin the following error, when I try to connect to Apache Derby using Hibernate. Can anyone let me know what this might be ???
> 
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions
>     [java] WARNING: SQL Error: -1, SQLState: 42Y07
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions
>     [java] SEVERE: Schema 'SYSTEM' does not exist
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions

42Y07 is a "schema doesn't exist" error. A description of why you might
get a schema doesn't exist error is here:

   http://db.apache.org/derby/faq.html#schema_exist

Here's a quote from that FAQ:

> However even though the current schema is set to the user name, that schema may not exist. A schema is only created by CREATE SCHEMA or creating an object (table etc.) in that schema (this is implicit schema creation).

I can reproduce the problem if I connect to a database as user 'system'
and try to select from a table, but no objects have been created by that
user yet:

   $ java org.apache.derby.tools.ij
   ij version 10.1
   ij> connect 'jdbc:derby:MyTest;user=system';
   ij> select * from foo;
   ERROR 42Y07: Schema 'SYSTEM' does not exist

As noted in the FAQ, the first table I create also creates the schema:

   ij> create table foo (id int);
   0 rows inserted/updated/deleted
   ij> select * from foo;
   ID
   -----------
   0 rows selected

I could also have created the schema first, then I would get an error
that the table doesn't exist instead of the schema doesn't exist error:

   ij> connect 'jdbc:derby:MyTest;user=system';
   ij> create schema system;
   0 rows inserted/updated/deleted
   ij> select * from foo;
   ERROR 42X05: Table 'FOO' does not exist.

Also a problem was logged specifically with creating a trigger when the
default schema doesn't exist; see

  http://issues.apache.org/jira/browse/DERBY-85

If none of this information helps you resolve your problem, feel free to
post more information, including the SQL statements executed when the
error occurs -- and please include the output from the command below,
which shows the version of Derby you're using:

  java org.apache.derby.tools.sysinfo

Incidently, "SYSTEM" isn't a Derby schema, though you might find that in
other database products. To view the schemas that come with Derby, you
can execute this query in your Derby database:

   select schemaname from sys.sysschemas;

regards,

 -jean


		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.

Re: Hibernate and Derby

Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Avin wrote:
> I am gettin the following error, when I try to connect to Apache Derby using Hibernate. Can anyone let me know what this might be ???
> 
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions
>     [java] WARNING: SQL Error: -1, SQLState: 42Y07
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions
>     [java] SEVERE: Schema 'SYSTEM' does not exist
>     [java] Apr 29, 2006 1:48:20 PM org.hibernate.util.JDBCExceptionReporter logE
> xceptions

42Y07 is a "schema doesn't exist" error. A description of why you might
get a schema doesn't exist error is here:

   http://db.apache.org/derby/faq.html#schema_exist

Here's a quote from that FAQ:

> However even though the current schema is set to the user name, that schema may not exist. A schema is only created by CREATE SCHEMA or creating an object (table etc.) in that schema (this is implicit schema creation).

I can reproduce the problem if I connect to a database as user 'system'
and try to select from a table, but no objects have been created by that
user yet:

   $ java org.apache.derby.tools.ij
   ij version 10.1
   ij> connect 'jdbc:derby:MyTest;user=system';
   ij> select * from foo;
   ERROR 42Y07: Schema 'SYSTEM' does not exist

As noted in the FAQ, the first table I create also creates the schema:

   ij> create table foo (id int);
   0 rows inserted/updated/deleted
   ij> select * from foo;
   ID
   -----------
   0 rows selected

I could also have created the schema first, then I would get an error
that the table doesn't exist instead of the schema doesn't exist error:

   ij> connect 'jdbc:derby:MyTest;user=system';
   ij> create schema system;
   0 rows inserted/updated/deleted
   ij> select * from foo;
   ERROR 42X05: Table 'FOO' does not exist.

Also a problem was logged specifically with creating a trigger when the
default schema doesn't exist; see

  http://issues.apache.org/jira/browse/DERBY-85

If none of this information helps you resolve your problem, feel free to
post more information, including the SQL statements executed when the
error occurs -- and please include the output from the command below,
which shows the version of Derby you're using:

  java org.apache.derby.tools.sysinfo

Incidently, "SYSTEM" isn't a Derby schema, though you might find that in
other database products. To view the schemas that come with Derby, you
can execute this query in your Derby database:

   select schemaname from sys.sysschemas;

regards,

 -jean