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 "Petrula, Dan" <DP...@thezenith.com> on 2007/05/10 22:51:29 UTC

TROUBLE CONNECTING TO SERVER USING CLIENT DRIVER

I have a linux server running Redhat ES4 and have Derby 10.2.2.0
installed. I can access the database at the server using the ij tool.
The server is on a lan with an ip address of 192.168.1.99. I can start
the Derby server using either the ip address and port 1527 or using
0.0.0.0 and port 1527 and successfully ping it using the Derby tool on
the linux machine.
 
However, I can't reach the linux server from a Windows XP machine on the
lan running  the ClientDriver. I can reach the Apache web server on the
linux machine and ping the linux server from the Windows computer so I
know the connection is there.
 
The Derby database on the linux server is installed at
/usr/local/derby/database/apolloDB.  My code on the Windows client
machine is as follows:
String driver = "org.apache.derby.jdbc.ClientDriver";
String dbURL =
"jdbc:derby://192.168.1.99:1527/usr/local/derby/database/apolloDB";
 
java.util.Properties prop = new java.util.Properties();
prop.setProperty("derby.system.home","/usr/local/derby/database");
prop.setProperty("user","dan");
prop.setProperty("password","starman");
 
Class.forName(driver).newInstance();
 
conn=DriverManager.getConnection(dbURL,prop);
 
My derby.properties file is in directory on the server
/usr/local/derby/database
 
derby.connection.requiredAuthentication=true
derby.authentication.provider=BUILTIN
derby.user.dan=starman
 
I get the message  at the client machine
 
'SQLException java.net.NoRouteToHostException: Error connection to
server 192.168.1.99 on port 1527 with message No route to host:connect.'
 
At the Windows client machine I used a windows utility to ping both the
host and the port. I could successfully ping the Apache Webserver
getting port 80, but
not the Derby server. Maybe because the Derby server requires a password
when connecting from an external source, I don't know.
Anyone have any suggestions? I have run out of ideas..

**********************************************************************
NOTICE:
This e-mail, including attachments, contains information that may be  confidential,  protected by the attorney/client or other privileges, or exempt from disclosure under applicable law. Further, this e-mail may contain information that is proprietary and/or constitutes a trade secret. This e-mail, including attachments, constitutes non-public information intended to be conveyed only to the designated recipient(s). If you are not an intended recipient of this communication, please be advised that any disclosure, dissemination, distribution, copying, or other use of this communication or any attached document is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by reply e-mail and promptly destroy all electronic and printed copies of this communication and any attached documents. 

**********************************************************************


Re: TROUBLE CONNECTING TO SERVER USING CLIENT DRIVER

Posted by Stanley Bradbury <St...@gmail.com>.
Raymond Kroeker wrote:
> Hi Dan,
>     It looks like the url you're using from the client isn't quite 
> right.  For a client/server url you want the logical database name in 
> the url after the port and not the path to the database.
>
>     So a single server can support multilple databases.  What you'll 
> want to try is something like
>
>     jdbc:derby://192.168.1.99:1527/apolloDB;create=true
>
>     instead of
>
>     jdbc:derby://192.168.1.99:1527/usr/local/derby/database/apolloDB
>
>     This too will create the db for you if it does not already exist.
=====  SNIP ====

The URL is incorrect resulting in the poor, confused client driver 
trying to find a host named 'connect' [note message: No route to 
host:connect].  Your URL needs another slash before 'usr' - the slash at 
the end of the port number is a URL delimiter then you another as part 
of the absolute path for the DB.  Note that derby.system.home is only 
meaningful to the Embedded Driver (embedded in Network Server) so has 
not effect in your client program.

And, as Bryan points out, be sure to specify the -h option 9 -h 
192.168.1.99) when starting Network server


Re: TROUBLE CONNECTING TO SERVER USING CLIENT DRIVER

Posted by Raymond Kroeker <ra...@raykroeker.com>.
Hi Dan,
    It looks like the url you're using from the client isn't quite right.
For a client/server url you want the logical database name in the url after
the port and not the path to the database.

    So a single server can support multilple databases.  What you'll want to
try is something like

    jdbc:derby://192.168.1.99:1527/apolloDB;create=true

    instead of

    jdbc:derby://192.168.1.99:1527/usr/local/derby/database/apolloDB

    This too will create the db for you if it does not already exist.

On 5/10/07, Petrula, Dan <DP...@thezenith.com> wrote:
>
>  I have a linux server running Redhat ES4 and have Derby 10.2.2.0installed. I can access the database at the server using the ij tool.
> The server is on a lan with an ip address of 192.168.1.99. I can start the
> Derby server using either the ip address and port 1527 or using
> 0.0.0.0 and port 1527 and successfully ping it using the Derby tool on the
> linux machine.
>
> However, I can't reach the linux server from a Windows XP machine on the
> lan running  the ClientDriver. I can reach the Apache web server on the
> linux machine and ping the linux server from the Windows computer so I
> know the connection is there.
>
> The Derby database on the linux server is installed at
> /usr/local/derby/database/apolloDB.  My code on the Windows client machine
> is as follows:
> String driver = "org.apache.derby.jdbc.ClientDriver";
> String dbURL =
> "jdbc:derby://192.168.1.99:1527/usr/local/derby/database/apolloDB";
>
> java.util.Properties prop = new java.util.Properties();
> prop.setProperty("derby.system.home","/usr/local/derby/database");
> prop.setProperty("user","dan");
> prop.setProperty("password","starman");
>
> Class.forName(driver).newInstance();
>
> conn=DriverManager.getConnection(dbURL,prop);
>
> My derby.properties file is in directory on the server
> /usr/local/derby/database
>
> derby.connection.requiredAuthentication=true
> derby.authentication.provider=BUILTIN
> derby.user.dan=starman
>
> I get the message  at the client machine
>
> 'SQLException java.net.NoRouteToHostException: Error connection to server
> 192.168.1.99 on port 1527 with message No route to host:connect.'
>
> At the Windows client machine I used a windows utility to ping both the
> host and the port. I could successfully ping the Apache Webserver getting
> port 80, but
> not the Derby server. Maybe because the Derby server requires a password
> when connecting from an external source, I don't know.
> Anyone have any suggestions? I have run out of ideas..
>
> **********************************************************************
>
> NOTICE:
>
> This e-mail, including attachments, contains information that may be
> confidential, protected by the attorney/client or other privileges, or
> exempt from disclosure under applicable law. Further, this e-mail may
> contain information that is proprietary and/or constitutes a trade secret.
> This e-mail, including attachments, constitutes non-public information
> intended to be conveyed only to the designated recipient(s). If you are not
> an intended recipient of this communication, please be advised that any
> disclosure, dissemination, distribution, copying, or other use of this
> communication or any attached document is strictly prohibited.  If you have
> received this communication in error, please notify the sender immediately
> by reply e-mail and promptly destroy all electronic and printed copies of
> this communication and any attached documents.
>
>
>
> **********************************************************************
>
>
>



-- 
---------------------------------------------------------
Raymond Kroeker

Re: TROUBLE CONNECTING TO SERVER USING CLIENT DRIVER

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> host and the port. I could successfully ping the Apache Webserver 
> getting port 80, but not the Derby server. 

You don't mention a lot about how you started the network server,
but are you using the "-h" parameter? Note that, as it says on:
http://db.apache.org/derby/docs/10.2/adminguide/tadmincbdjhhfd.html

     By default, the Network Server will listen to requests only on
     the loopback address, which means that it will only accept
     connections from the local host.

If you want to connect to the Network Server remotely, you need to
use "-h" to tell it to listen on more than just the internal address.

thanks,

bryan