db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: Embedded driver create=true problem
Date Tue, 30 Aug 2005 01:00:24 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I don't think there has been any change in Derby from 10.0 to 10.1.
Derby doesn't create user schema until either created by the user or
gets implicitly created when a table is created in that schema. This
hasn't changed.<br>
<br>
Try this to confirm: ( I tried this on 10.0.2.0)<br>
ij(CONNECTION1)&gt; connect
'jdbc:derby:testdb;user=satheesh;create=true';<br>
ij(CONNECTION2)&gt; values cast(current schema as char(10));<br>
1<br>
----------<br>
SATHEESH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;======================= <b>Schema name</b><br>
1 row selected<br>
ij(CONNECTION2)&gt; select * from sys.sysschemas where schemaname like
'SATH%';<br>
SCHEMAID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|SCHEMANAME<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; |AUTHORIZATIONID<br>
<br>
--------------------------------------------------------------------------------<br>
--------------------------------------------------------------------------------<br>
--------------------------------------------------------------------------------<br>
------------------------------------------------------<br>
<br>
0 rows selected&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;========================= <b>Schema doesn't exists</b><br>
ij(CONNECTION2)&gt; create table junk ( i int);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;===============&nbsp; <b>Create a table</b><br>
0 rows inserted/updated/deleted<br>
ij(CONNECTION2)&gt; select * from sys.sysschemas where schemaname like
'SATH%';<br>
SCHEMAID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|SCHEMANAME<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; |AUTHORIZATIONID<br>
<br>
--------------------------------------------------------------------------------<br>
--------------------------------------------------------------------------------<br>
--------------------------------------------------------------------------------<br>
------------------------------------------------------<br>
f14580e4-0106-04dd-7e25-000000145d58|SATHEESH<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; |SATHEESH<br>
<br>
<br>
1 row selected&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;====================== <b>Schema is present now.</b><br>
ij(CONNECTION2)&gt;<br>
<br>
Satheesh<br>
<br>
Geert Bevin wrote:<br>
<blockquote cite="midfeccda205082602454769a7df@mail.gmail.com"
 type="cite">
  <pre wrap="">Hello,

in Derby 10.0.2.1, when you add create=true to the embedded driver's
jdbc connection url, the database is created together with the user
schema for the one that's opening the connection. Only after both are
created, the SQL command is actually executed.

It seems that this behavior changed in Derby 10.1.1.0. The database is
created, but the SQL is executed before the user schema is created.
This generates errors like this:

WARNING: com.uwyn.rife.database.exceptions.ExecutionErrorException:
Error while executing the SQL 'CREATE TABLE newsitem (id INTEGER NOT
NULL GENERATED ALWAYS AS IDENTITY, moment TIMESTAMP NOT NULL, title
VARCHAR(120) NOT NULL, PRIMARY KEY (id), CHECK (title != ''))'.
    at com.uwyn.rife.database.DbStatement.executeUpdate(DbStatement.java:646)
    at com.uwyn.rife.database.DbStatement.executeUpdate(DbStatement.java:673)
    at com.uwyn.rife.database.DbQueryManager.executeUpdate(DbQueryManager.java:173)
    at com.uwyn.rife.database.querymanagers.generic.databasedrivers.org_apache_derby_jdbc_EmbeddedDriver.install(org_apache_derby_jdbc_EmbeddedDriver.java:65)
    at com.uwyn.rife.database.querymanagers.generic.GenericQueryManagerDelegate.install(GenericQueryManagerDelegate.java:73)
    at com.uwyn.rife.jumpstart.InstallParticipant.initialize(InstallParticipant.java:33)
    at com.uwyn.rife.rep.BlockingParticipant.run(BlockingParticipant.java:250)
    at java.lang.Thread.run(Thread.java:613)
Caused by: SQL Exception: Schema 'NEWS' does not exist
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
    at com.uwyn.rife.database.DbStatement.executeUpdate(DbStatement.java:638)
    ... 7 more

If you wait a while and re-issue the same SQL command afterwards, it
succeeds. I'm quite puzzled why this behavior changed, since in its
latest form it's quite useless. Any comments about this?

Thanks,

Geert

  </pre>
</blockquote>
</body>
</html>


Mime
View raw message