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 Peter Nabbefeld <Pe...@gmx.de> on 2005/04/22 13:30:17 UTC
Automatic database and schema creation
Hello,
I just want to create a database, if it does not yet exist. Database
creation works, schema creation does not. I'm using the following syntax
(in Java):
Statement stmt = con.createStatement();
stmt.execute("CREATE SCHEMA USER");
The result is an SQLException with SQLState = 42X01 (Syntax error).
What am I doing wrong? Before creation, I'm trying to insert a record.
If an Exception is thrown, I ask for status 42Y07 (Schema does not
exist). Derby is stable version (10.0.2.1).
Kind regards
Peter Nabbefeld
Re: Automatic database and schema creation
Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
Derby client patch was put to vote through end of last week. From what I
can tell, it seems to have passed. Pending some CCLA issues, the client
should be part of next Derby release.
Satheesh
Jonathan Eric Miller wrote:
> Thanks for the info. It's good to hear that IBM followed through with
> turning over the source code for the JDBC driver. Does anyone know if
> the new JDBC driver will be bundled with the next release of Derby?
> Does anyone know when the next version is due for release?
>
> Jon
>
> ----- Original Message ----- From: "Jean T. Anderson"
> <jt...@bristowhill.com>
> To: "Derby Discussion" <de...@db.apache.org>
> Sent: Friday, April 22, 2005 4:59 PM
> Subject: Re: Automatic database and schema creation
>
>
>> Hi, Jon,
>>
>> Yes; the Derby client is a type 4 JDBC driver that works with the
>> Derby Network Server.
>>
>> I just realized that the mod_mbox link I sent points to wads of html
>> encoding that make Satheesh's post hard to read. :-( Try the copy at
>> gmane -- it even has a nice presentation (at least in firefox) for
>> the functional spec that Satheesh attached:
>>
>> http://article.gmane.org/gmane.comp.apache.db.derby.devel/2960
>>
>> But please post any feedback regarding the proposed contribution to
>> derby-dev@db.apache.org. derby-user will be notified after the
>> development process has been completed and any outstanding issues
>> have been resolved.
>>
>> regards,
>>
>> -jean
>>
>>
>> Jonathan Eric Miller wrote:
>>
>>> Thanks for the info. So is "Derby client" the JDBC driver?
>>>
>>> Jon
>>>
>>> ----- Original Message ----- From: "Jean T. Anderson"
>>> <jt...@bristowhill.com>
>>> To: "Derby Discussion" <de...@db.apache.org>
>>> Sent: Friday, April 22, 2005 3:07 PM
>>> Subject: Re: Automatic database and schema creation
>>>
>>>
>>>> Jonathan Eric Miller wrote:
>>>>
>>>>> <snip />
>>>>> It's set to false by default. Supposedly, this will be changed
>>>>> when IBM releases the source code to the JDBC driver. Any word on
>>>>> when that's going to happen?
>>>>
>>>>
>>>>
>>>> There's activity on the derby-dev@db.apache.org list :
>>>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c425D9E78.3040106@Sourcery.Org%3e
>>>>
>>>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c42653AEC.70709@Sourcery.Org%3e
>>>>
>>>>
>>>> -jean
>>>>
>>>
>>
>
>
>
Re: Automatic database and schema creation
Posted by Jonathan Eric Miller <je...@uchicago.edu>.
Thanks for the info. It's good to hear that IBM followed through with
turning over the source code for the JDBC driver. Does anyone know if the
new JDBC driver will be bundled with the next release of Derby? Does anyone
know when the next version is due for release?
Jon
----- Original Message -----
From: "Jean T. Anderson" <jt...@bristowhill.com>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Friday, April 22, 2005 4:59 PM
Subject: Re: Automatic database and schema creation
> Hi, Jon,
>
> Yes; the Derby client is a type 4 JDBC driver that works with the Derby
> Network Server.
>
> I just realized that the mod_mbox link I sent points to wads of html
> encoding that make Satheesh's post hard to read. :-( Try the copy at
> gmane -- it even has a nice presentation (at least in firefox) for the
> functional spec that Satheesh attached:
>
> http://article.gmane.org/gmane.comp.apache.db.derby.devel/2960
>
> But please post any feedback regarding the proposed contribution to
> derby-dev@db.apache.org. derby-user will be notified after the development
> process has been completed and any outstanding issues have been resolved.
>
> regards,
>
> -jean
>
>
> Jonathan Eric Miller wrote:
>> Thanks for the info. So is "Derby client" the JDBC driver?
>>
>> Jon
>>
>> ----- Original Message ----- From: "Jean T. Anderson"
>> <jt...@bristowhill.com>
>> To: "Derby Discussion" <de...@db.apache.org>
>> Sent: Friday, April 22, 2005 3:07 PM
>> Subject: Re: Automatic database and schema creation
>>
>>
>>> Jonathan Eric Miller wrote:
>>>
>>>> <snip />
>>>> It's set to false by default. Supposedly, this will be changed when IBM
>>>> releases the source code to the JDBC driver. Any word on when that's
>>>> going to happen?
>>>
>>>
>>> There's activity on the derby-dev@db.apache.org list :
>>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c425D9E78.3040106@Sourcery.Org%3e
>>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c42653AEC.70709@Sourcery.Org%3e
>>>
>>> -jean
>>>
>>
>
Re: Automatic database and schema creation
Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Hi, Jon,
Yes; the Derby client is a type 4 JDBC driver that works with the Derby
Network Server.
I just realized that the mod_mbox link I sent points to wads of html
encoding that make Satheesh's post hard to read. :-( Try the copy at
gmane -- it even has a nice presentation (at least in firefox) for the
functional spec that Satheesh attached:
http://article.gmane.org/gmane.comp.apache.db.derby.devel/2960
But please post any feedback regarding the proposed contribution to
derby-dev@db.apache.org. derby-user will be notified after the
development process has been completed and any outstanding issues have
been resolved.
regards,
-jean
Jonathan Eric Miller wrote:
> Thanks for the info. So is "Derby client" the JDBC driver?
>
> Jon
>
> ----- Original Message ----- From: "Jean T. Anderson" <jt...@bristowhill.com>
> To: "Derby Discussion" <de...@db.apache.org>
> Sent: Friday, April 22, 2005 3:07 PM
> Subject: Re: Automatic database and schema creation
>
>
>> Jonathan Eric Miller wrote:
>>
>>> <snip />
>>> It's set to false by default. Supposedly, this will be changed when
>>> IBM releases the source code to the JDBC driver. Any word on when
>>> that's going to happen?
>>
>>
>> There's activity on the derby-dev@db.apache.org list :
>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c425D9E78.3040106@Sourcery.Org%3e
>>
>> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c42653AEC.70709@Sourcery.Org%3e
>>
>>
>> -jean
>>
>
Re: Automatic database and schema creation
Posted by Jonathan Eric Miller <je...@uchicago.edu>.
Thanks for the info. So is "Derby client" the JDBC driver?
Jon
----- Original Message -----
From: "Jean T. Anderson" <jt...@bristowhill.com>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Friday, April 22, 2005 3:07 PM
Subject: Re: Automatic database and schema creation
> Jonathan Eric Miller wrote:
>> <snip />
>> It's set to false by default. Supposedly, this will be changed when IBM
>> releases the source code to the JDBC driver. Any word on when that's
>> going to happen?
>
> There's activity on the derby-dev@db.apache.org list :
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c425D9E78.3040106@Sourcery.Org%3e
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c42653AEC.70709@Sourcery.Org%3e
>
> -jean
>
Re: Automatic database and schema creation
Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Jonathan Eric Miller wrote:
> <snip />
> It's set to false by default. Supposedly, this will be changed when IBM
> releases the source code to the JDBC driver. Any word on when that's
> going to happen?
There's activity on the derby-dev@db.apache.org list :
http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c425D9E78.3040106@Sourcery.Org%3e
http://mail-archives.apache.org/mod_mbox/db-derby-dev/200504.mbox/%3c42653AEC.70709@Sourcery.Org%3e
-jean
Re: Automatic database and schema creation
Posted by Jonathan Eric Miller <je...@uchicago.edu>.
I don't know if it's the case that you are already doing this, but, you can
get better error messages if you set the following driver attribute. It's
set to false by default. Supposedly, this will be changed when IBM releases
the source code to the JDBC driver. Any word on when that's going to happen?
I thought they were supposed to do it a long time ago...
retrieveMessagesFromServerOnGetMessage=true
Jon
----- Original Message -----
From: "Øystein Grøvlen - Sun Norway" <Oy...@Sun.COM>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Friday, April 22, 2005 7:04 AM
Subject: Re: Automatic database and schema creation
> Peter Nabbefeld wrote:
>>
>> Hello,
>>
>> I just want to create a database, if it does not yet exist. Database
>> creation works, schema creation does not. I'm using the following syntax
>> (in Java):
>>
>> Statement stmt = con.createStatement();
>> stmt.execute("CREATE SCHEMA USER");
>>
>> The result is an SQLException with SQLState = 42X01 (Syntax error).
>> What am I doing wrong? Before creation, I'm trying to insert a record. If
>> an Exception is thrown, I ask for status 42Y07 (Schema does not exist).
>> Derby is stable version (10.0.2.1).
>>
>
> USER is a reserved word. I think it would be nice if the error message
> reflected that.
>
> --
> Øystein
>
Re: Automatic database and schema creation
Posted by Øystein Grøvlen <Oy...@Sun.COM>.
>>>>> "ØG" == Øystein Grøvlen <- Sun Norway <Oy...@Sun.COM>> writes:
ØG> Peter Nabbefeld wrote:
>> Hello,
>> I just want to create a database, if it does not yet exist. Database
>> creation works, schema creation does not. I'm using the following
>> syntax (in Java):
>> Statement stmt = con.createStatement();
>> stmt.execute("CREATE SCHEMA USER");
>> The result is an SQLException with SQLState = 42X01 (Syntax error).
>> What am I doing wrong? Before creation, I'm trying to insert a
>> record. If an Exception is thrown, I ask for status 42Y07 (Schema
>> does not exist). Derby is stable version (10.0.2.1).
>>
ØG> USER is a reserved word. I think it would be nice if the error
ØG> message reflected that.
When I tried this myself in the embedded configuration, I got:
ERROR 42X01: Syntax error: Encountered "user" at line 1, column 15.
which should give you a hint of what the problem is. Is it possible
to change the message to "Encountered reserved word "user" at ..."?
--
Øystein
Re: Automatic database and schema creation
Posted by Peter Nabbefeld <Pe...@gmx.de>.
Thank You, it works now.
Peter
Øystein Grøvlen - Sun Norway schrieb:
> Peter Nabbefeld wrote:
>
>>
>> Hello,
>>
>> I just want to create a database, if it does not yet exist. Database
>> creation works, schema creation does not. I'm using the following
>> syntax (in Java):
>>
>> Statement stmt = con.createStatement();
>> stmt.execute("CREATE SCHEMA USER");
>>
>> The result is an SQLException with SQLState = 42X01 (Syntax error).
>> What am I doing wrong? Before creation, I'm trying to insert a record.
>> If an Exception is thrown, I ask for status 42Y07 (Schema does not
>> exist). Derby is stable version (10.0.2.1).
>>
>
> USER is a reserved word. I think it would be nice if the error message
> reflected that.
>
> --
> Øystein
>
Re: Automatic database and schema creation
Posted by Øystein Grøvlen - Sun Norway <Oy...@Sun.COM>.
Peter Nabbefeld wrote:
>
> Hello,
>
> I just want to create a database, if it does not yet exist. Database
> creation works, schema creation does not. I'm using the following syntax
> (in Java):
>
> Statement stmt = con.createStatement();
> stmt.execute("CREATE SCHEMA USER");
>
> The result is an SQLException with SQLState = 42X01 (Syntax error).
> What am I doing wrong? Before creation, I'm trying to insert a record.
> If an Exception is thrown, I ask for status 42Y07 (Schema does not
> exist). Derby is stable version (10.0.2.1).
>
USER is a reserved word. I think it would be nice if the error message
reflected that.
--
Øystein