derby+odbc problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

derby+odbc problem

zentol
Hello derby-user,

Hello

first of all sorry for my english

Derby network server should runtime starts/stops and works with databases lying in different directories(partitions).

I start the first DB so:
String DBURL="jdbc:derby:directory:D:/Projects/warehouse/problem;create=true;"
   Properties properties = new java.util.Properties();
   properties.setProperty("user","cloud");
   properties.setProperty("password","scape");
 Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();

 conn =  (Connection) DriverManager.getConnection(DBURL, properties);

And the second one:
String DBURL="jdbc:derby:directory:isOK;create=true;"

The problem is:
when i am trying to connect to DB 'isOK' via ODBC (for example - test connection in windows ODBC-manager) all is OK. But when to DB 'problem', specifying DatabaseName='problem' i get the following error in ODBC-manager:
SQL30061N       The database alias or database name "PROBLEM     " was not found at the remote node.

It seems that derby can't find DB locating in non derby.system.home location.

If I specify derby.system.home=D:/Projects/warehouse when starting up NS, connection test passed in ODBC-manager. But i can't restart NS all the time when i need to start another DB, furthermore there can be two working DBs in different directories.

Thanks for any help!
 

--
Best regards,
 zentol                          mailto:[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: derby+odbc problem

Army-5
zentol wrote:
> It seems that derby can't find DB locating in non derby.system.home location.
>

For an ODBC connection using DB2, this is true.  When you catalog a db in DB2,
the database name cannot have a path in it.  Since a database name can't include
a path, the only place the Derby server is going to be able to find the database
is in its home directory, derby.system.home.

This isn't a problem for Java connections because both Java clients (JCC and the
Derby Network Client) allow a path to be specified as part of the URL.  But
since there's no way to do that with the DB2 ODBC client (so far as I know), all
ODBC databases have to exist within the derby.system.home directory (or, if that
property isn't set, within the directory in which the server is started).

> If I specify derby.system.home=D:/Projects/warehouse when starting up NS,
> connection test passed in ODBC-manager. [ snip ] furthermore there can be
> two working DBs in different directories.

Again, I think this is a limitation that comes from the client, not from Derby
itself.  Thus it is not currently possible to have a single server access two
databases in different directories if the DB2 ODBC client is being used.

If you really need that functionality, I think you will have to start two Derby
servers on different ports with different home directories, and then catalog one
database per server.  It's not ideal, but I think it should work...

Army