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 Jim McNamara <th...@yahoo.com> on 2008/07/13 23:01:06 UTC
connection url not working
hi-if i use this for a connection string:jdbc:derby://localhost:1527/home/thirdshift/JADE_DB(it connects)my program can find the data files in that folder.if i try to move to a different location with the datafiles:jdbc:derby://localhost:1527/home/thirdshift/b1/JADE_DB(not connect)i get the msg:Caused by: org.apache.derby.client.am.DisconnectException: The connection was refused because the database home/thirdshift/b1/JADE_DB was not found.i dont know what setting i need to put so that i can move the location of the dataaround. this is important as i want to deploy my application and dont want the userto have to specify the exact same path as me. they actually cant in linux astheir /home/<username> will be different.thanks for any tips,jim
Re: connection url not working
Posted by Jim McNamara <th...@yahoo.com>.
hi bryan-excellent. thank you. i will look into it tonight when i get home from work.i'm sure this solution/procedure you suggested will work.i now have a better understanding and will continue toread docs.thanks very much,jim
--- On Mon, 7/14/08, Bryan Pendleton <bp...@amberpoint.com> wrote:
From: Bryan Pendleton <bp...@amberpoint.com>
Subject: Re: connection url not working
To: "Derby Discussion" <de...@db.apache.org>
Date: Monday, July 14, 2008, 10:23 AM
> Jim McNamara wrote:
>> but what i dont understand is if i send go/to/the/moon path and db
>> to trash in konqueror file manager, that squirrel sql still
>> connects as if it was there
I believe that the Unix/Linux systems behave differently with
respect to deleting files than Windows does. In Linux, you can
delete a file (move it to the trash in Konqueror), but if a
process currently has that file open, that process will continue
to be allowed to access the file.
So I think what you are seeing is that the Derby network server
was not shut down when you moved the db to the trash, and the
server still had the files open.
So if you:
- shut down the Derby network server process
- move the database to the trash
- start the network server back up
then I would be quite surprised to learn that you are still able
to access the database.
thanks,
bryan
Re: connection url not working
Posted by Bryan Pendleton <bp...@amberpoint.com>.
> Jim McNamara wrote:
>> but what i dont understand is if i send go/to/the/moon path and db
>> to trash in konqueror file manager, that squirrel sql still
>> connects as if it was there
I believe that the Unix/Linux systems behave differently with
respect to deleting files than Windows does. In Linux, you can
delete a file (move it to the trash in Konqueror), but if a
process currently has that file open, that process will continue
to be allowed to access the file.
So I think what you are seeing is that the Derby network server
was not shut down when you moved the db to the trash, and the
server still had the files open.
So if you:
- shut down the Derby network server process
- move the database to the trash
- start the network server back up
then I would be quite surprised to learn that you are still able
to access the database.
thanks,
bryan
Re: connection url not working
Posted by Jim McNamara <th...@yahoo.com>.
hi john-it helps a lot!
i will save these messages from you and bryan somewherewhere i can refer back to them.i feel like i can get back on track now.i have to wait a bit to get to it but i want to get backto this and get it straight soon.very cool.thanks,jim
--- On Mon, 7/14/08, John Embretsen <Jo...@Sun.COM> wrote:
From: John Embretsen <Jo...@Sun.COM>
Subject: Re: connection url not working
To: "Derby Discussion" <de...@db.apache.org>
Date: Monday, July 14, 2008, 4:35 AM
Jim McNamara wrote:
> Hi Byran-
> i think i am starting to piece this together a little bit.derby has a
system directory specified by derby.system.homeas i put a connection url
jdbc:derby://localhost:1527/go/to/the/moon;create=true;it creates that path in
my system directory and moon will be the dbcontaining
seg0,tmp,log,service.propertiesso that is where my storage mysteriously is
kept.but what i dont understand is if i send go/to/the/moon path and dbto trash
in konqueror file manager, that squirrel sql still connects as if it was there
residing in system directory.so is there another place it resides? why when you
send stuff to the trashcan you still connect and even see tables and run sql?it
is crazy.thanks,jim--- On Sun, 7/13/08, Bryan Pendleton
<bp...@amberpoint.com> wrote:
Right, if you move the data in your file system, you should not be able
to connect to the database using the same connection URL and the same
derby system home.
I suspect that you have several copies of the database around. Try
searching for directories named "moon" (or whatever the name of your
database is) to check for sure.
Note that in your original URL,
jdbc:derby://localhost:1527/home/thirdshift/JADE_DB
the path to the database may not resolve to what you think it resolves
to. The URL looks absolute, but it is not. For it to be absolute, you
need another / between the port number and the path:
jdbc:derby://localhost:1527//home/thirdshift/JADE_DB
This is because the first / separates the port number from the database
path, and the second / denotes an absolute path on Unix/Linux systems.
The above URL will resolve to the directory /home/thirdshift/JADE_DB.
If your connection URL path is not absolute, it will resolve as relative
to the system home directory, for example
/home/youruser/databases/home/thirdshift/JADE_DB
Hope this helps,
--
John
Re: connection url not working
Posted by John Embretsen <Jo...@Sun.COM>.
Jim McNamara wrote:
> Hi Byran-
> i think i am starting to piece this together a little bit.derby has a system directory specified by derby.system.homeas i put a connection url jdbc:derby://localhost:1527/go/to/the/moon;create=true;it creates that path in my system directory and moon will be the dbcontaining seg0,tmp,log,service.propertiesso that is where my storage mysteriously is kept.but what i dont understand is if i send go/to/the/moon path and dbto trash in konqueror file manager, that squirrel sql still connects as if it was there residing in system directory.so is there another place it resides? why when you send stuff to the trashcan you still connect and even see tables and run sql?it is crazy.thanks,jim--- On Sun, 7/13/08, Bryan Pendleton <bp...@amberpoint.com> wrote:
Right, if you move the data in your file system, you should not be able
to connect to the database using the same connection URL and the same
derby system home.
I suspect that you have several copies of the database around. Try
searching for directories named "moon" (or whatever the name of your
database is) to check for sure.
Note that in your original URL,
jdbc:derby://localhost:1527/home/thirdshift/JADE_DB
the path to the database may not resolve to what you think it resolves
to. The URL looks absolute, but it is not. For it to be absolute, you
need another / between the port number and the path:
jdbc:derby://localhost:1527//home/thirdshift/JADE_DB
This is because the first / separates the port number from the database
path, and the second / denotes an absolute path on Unix/Linux systems.
The above URL will resolve to the directory /home/thirdshift/JADE_DB.
If your connection URL path is not absolute, it will resolve as relative
to the system home directory, for example
/home/youruser/databases/home/thirdshift/JADE_DB
Hope this helps,
--
John
Re: connection url not working
Posted by Jim McNamara <th...@yahoo.com>.
Hi Byran-
i think i am starting to piece this together a little bit.derby has a system directory specified by derby.system.homeas i put a connection url jdbc:derby://localhost:1527/go/to/the/moon;create=true;it creates that path in my system directory and moon will be the dbcontaining seg0,tmp,log,service.propertiesso that is where my storage mysteriously is kept.but what i dont understand is if i send go/to/the/moon path and dbto trash in konqueror file manager, that squirrel sql still connects as if it was there residing in system directory.so is there another place it resides? why when you send stuff to the trashcan you still connect and even see tables and run sql?it is crazy.thanks,jim--- On Sun, 7/13/08, Bryan Pendleton <bp...@amberpoint.com> wrote:
From: Bryan Pendleton <bp...@amberpoint.com>
Subject: Re: connection url not working
To: "Derby Discussion" <de...@db.apache.org>
Date: Sunday, July 13, 2008, 5:17 PM
> if i try to move to a different location with the datafiles:
>
> jdbc:derby://localhost:1527/home/thirdshift/b1/JADE_DB
Simply changing the URL won't move the data; the data still
resides in the database at its original location.
To move the data, you could:
- backup and restore the database
- export the data from the old DB, then import it to the new one
- write a program of your own to read the data out of the old
DB and write it to the new DB
The database can be located at any location, and you can certainly
set up your program so that your users can choose a different
location than you have used.
However, once a location is chosen for the database, you'll
need to consistently use that same location in the connection URL
in order to successfully access that database.
So, make your connection URL configurable, but once your users
have selected a particular location, set the URL to point to
that location and use it from then on.
thanks,
bryan
Re: connection url not working
Posted by Bryan Pendleton <bp...@amberpoint.com>.
> if i try to move to a different location with the datafiles:
>
> jdbc:derby://localhost:1527/home/thirdshift/b1/JADE_DB
Simply changing the URL won't move the data; the data still
resides in the database at its original location.
To move the data, you could:
- backup and restore the database
- export the data from the old DB, then import it to the new one
- write a program of your own to read the data out of the old
DB and write it to the new DB
The database can be located at any location, and you can certainly
set up your program so that your users can choose a different
location than you have used.
However, once a location is chosen for the database, you'll
need to consistently use that same location in the connection URL
in order to successfully access that database.
So, make your connection URL configurable, but once your users
have selected a particular location, set the URL to point to
that location and use it from then on.
thanks,
bryan