db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DerbyNoob <thestarchi...@hotmail.com>
Subject Re: is it possible to create a schema at connection time?
Date Tue, 03 Feb 2009 13:00:10 GMT

Kristian Waagan-4 wrote:
> DerbyNoob wrote:
>> Ok here is my scenario: 
>> I have two java applications, which are going to use the same database
>> (embedded as a derby server), but with 2 different schemas.  I want each
>> application to use its own schema. Currently a application connects to
>> the
>> database  like this: connect
>> 'jdbc:derby://localhost:1527/ExampleDatabase;
>> create = true; user = Schema1';   respectively "Schema2"  . But if the
>> schemas Schema1 and Schema2 does not exist, the default schema app will
>> be
>> used.  So my question is: is it somehow possible to create a schema at
>> database creating time? 
> Hello,
> Is it good enough to have the schema created implicitly when you create 
> the first table?
> If I do this, I get a schema called 'schema1' in my database:
> connect 'jdbc:derby:testDB;create=true;user=schema1;password=schema1';
> # Database created, schema1 does not exist.
> create table mytable (id int);
> # The table has now been created as SCHEMA1.MYTABLE.
> Also, do you want to use the embedded driver, or the client driver?
> The JDBC URL uses the client driver, but if you only need to connect to 
> the database from within the application (same JVM process), you could 
> also use the embedded driver.
> Regards,
> -- 
> Kristian

Hello Kristian, 

thank you very much=)! It is good enough to create the schema implicit when
I create the first table.
I didn't knew that!
I am currently using the ClientDriver, because the two applications are
using 2 different jvm processes.

Kind Regards,


View this message in context: http://www.nabble.com/is-it-possible-to-create-a-schema-at-connection-time--tp21808871p21809383.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

View raw message