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 Dy...@Sun.COM on 2005/09/16 16:29:28 UTC

Re: embedded apache derby on Windows connection URL

The following message is a courtesy copy of an article
that has been posted to comp.lang.java.databases as well.

supermail99@fastmail.fm writes:

> I'm having trouble creating a proper Java connection URL for an
> embedded apache derby database on Windows. My database folder was
> created with ij and is located at
>
> C:\mytestdb
>
> In my program the following line yeilds the error
>
> SQL Exception: Database 'mytestdb' not found.
>
> Connection
> conn=DriverManager.getConnection("jdbc:derby:C:///mytestdb");
>
> What is wrong with this URL?

I don't use Windows, but on Linux I can say
getConnection("jdbc:derby:/tmp/foo")

and I think that jdbc:derby:c:/mytestdb will work on windows

See 
http://db.apache.org/derby/docs/10.1/devguide/
(section Database Connection Examples)

> or, if I use the connection string "jdbc:derby:mytestdb", what is the
> search path?

It's relative to the property derby.system.home
see 
http://db.apache.org/derby/docs/10.1/tuning/
(see the section about properties)

-- 
dt



Re: embedded apache derby on Windows connection URL

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Rajesh Kartha wrote:

> Here is one example  to connect to a Derby database in Windows:
> 
> Connection conn=DriverManager.getConnection("jdbc:derby:c:\\temp\\my new
> dir\\a temp\\b temp\\spdb");
> (The above  also shows directories with spaces)


Any forward slashes in the database name portion of the JDBC URL will be
converted to the correct file separator for the platform. Thus for
consistency forward slashes are preferred.

Dan.



Re: embedded apache derby on Windows connection URL

Posted by Rajesh Kartha <ka...@Source-Zone.Org>.
Here is one example  to connect to a Derby database in Windows:

Connection conn=DriverManager.getConnection("jdbc:derby:c:\\temp\\my new 
dir\\a temp\\b temp\\spdb");
(The above  also shows directories with spaces)

Hope it helps.

-Rajesh

Dyre.Tjeldvoll@Sun.COM wrote:

>The following message is a courtesy copy of an article
>that has been posted to comp.lang.java.databases as well.
>
>supermail99@fastmail.fm writes:
>
>  
>
>>I'm having trouble creating a proper Java connection URL for an
>>embedded apache derby database on Windows. My database folder was
>>created with ij and is located at
>>
>>C:\mytestdb
>>
>>In my program the following line yeilds the error
>>
>>SQL Exception: Database 'mytestdb' not found.
>>
>>Connection
>>conn=DriverManager.getConnection("jdbc:derby:C:///mytestdb");
>>
>>What is wrong with this URL?
>>    
>>
>
>I don't use Windows, but on Linux I can say
>getConnection("jdbc:derby:/tmp/foo")
>
>and I think that jdbc:derby:c:/mytestdb will work on windows
>
>See 
>http://db.apache.org/derby/docs/10.1/devguide/
>(section Database Connection Examples)
>
>  
>
>>or, if I use the connection string "jdbc:derby:mytestdb", what is the
>>search path?
>>    
>>
>
>It's relative to the property derby.system.home
>see 
>http://db.apache.org/derby/docs/10.1/tuning/
>(see the section about properties)
>
>  
>