db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: is it possible to create a schema at connection time?
Date Tue, 03 Feb 2009 12:50:20 GMT
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

Mime
View raw message