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 DerbyNoob <th...@hotmail.com> on 2009/02/03 13:25:49 UTC
is it possible to create a schema at connection time?
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?
--
View this message in context: http://www.nabble.com/is-it-possible-to-create-a-schema-at-connection-time--tp21808871p21808871.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: is it possible to create a schema at connection time?
Posted by DerbyNoob <th...@hotmail.com>.
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,
Dorell
--
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.
Re: is it possible to create a schema at connection time?
Posted by Kristian Waagan <Kr...@Sun.COM>.
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