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 musky <mu...@gmail.com> on 2008/06/01 12:22:27 UTC

Connecting to Derby Network Server through the Internet

I am trying to run the derby network server on one machine and trying to
access the database on that machine from another machine.

just for testing purposes,on the client program i give the IP address of the
server machine(found out by going to findmyip.com).

When i try to connect using DriverManager.getconnection(URL),it gives me the
following stacktrace:

Cannot load Databasejava.sql.SQLNonTransientConnectionException:
java.net.ConnectException : Error connecting to server 59.96.37.195 on port
1527 with message Connection refused: connect.
java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
Error connecting to server 59.96.37.195 on port 1527 with message Connection
refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at GUIModules.DefaultMain.main(DefaultMain.java:11)
Caused by: org.apache.derby.client.am.DisconnectException:
java.net.ConnectException : Error connecting to server 59.96.37.195 on port
1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
Source)
	... 13 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 19 more
java.lang.NullPointerException
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at GUIModules.DefaultMain.main(DefaultMain.java:11)
Cannot load Databasejava.sql.SQLNonTransientConnectionException:
java.net.ConnectException : Error connecting to server 59.96.37.195 on port
1527 with message Connection refused: connect.
java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
Error connecting to server 59.96.37.195 on port 1527 with message Connection
refused: connect.
	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
Source)
	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at GUIModules.DefaultMain.main(DefaultMain.java:11)
Caused by: org.apache.derby.client.am.DisconnectException:
java.net.ConnectException : Error connecting to server 59.96.37.195 on port
1527 with message Connection refused: connect.
	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
	at
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
Source)
	... 21 more
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at java.net.Socket.<init>(Unknown Source)
	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 27 more
java.lang.NullPointerException
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at
GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
	at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
	at
GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
	at GUIModules.DefaultMain.main(DefaultMain.java:11)
-- 
View this message in context: http://www.nabble.com/Connecting-to-Derby-Network-Server-through-the-Internet-tp17584140p17584140.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Connecting to Derby Network Server through the Internet

Posted by musky <mu...@gmail.com>.
i have added port 1527 to the list of exceptions in windows firewall.

but still no luck

please help
thank you.


Valentin Cozma wrote:
> 
> musky wrote:
>> i have a name mapped to my IP address called "j2m3world.servehttp.com"
>> using
>> a no-ip dynamic update client. 
>>  have added derby to the list of exceptions in windows firewall.
>> i have configured my modem to run in bridged mode,so there is no question
>> of
>> forwarding ports.
>> i start derby with the option -h 0.0.0.0
>>
>> but still nothing seems to work.
>>
>> i dont know what more i have to do.
>>   
> 
> windows firewall.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Connecting-to-Derby-Network-Server-through-the-Internet-tp17584140p17594454.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Connecting to Derby Network Server through the Internet

Posted by Valentin Cozma <vc...@elfyard.com>.
musky wrote:
> i have a name mapped to my IP address called "j2m3world.servehttp.com" using
> a no-ip dynamic update client. 
>  have added derby to the list of exceptions in windows firewall.
> i have configured my modem to run in bridged mode,so there is no question of
> forwarding ports.
> i start derby with the option -h 0.0.0.0
>
> but still nothing seems to work.
>
> i dont know what more i have to do.
>   

windows firewall.


Re: Connecting to Derby Network Server through the Internet

Posted by Kristian Waagan <Kr...@Sun.COM>.
musky wrote:
> i have a name mapped to my IP address called "j2m3world.servehttp.com" using
> a no-ip dynamic update client. 
>  have added derby to the list of exceptions in windows firewall.
> i have configured my modem to run in bridged mode,so there is no question of
> forwarding ports.
> i start derby with the option -h 0.0.0.0
> 
> but still nothing seems to work.
> 
> i dont know what more i have to do.

Try using telnet to connect to the database server. If you get a 
connection, just write some rubbish there. You should then see 
exceptions regarding protocol errors in the windows / shell where you 
started the Derby network server.
You could start out by doing this from the same machine, then another 
machine in you home network and finally from a machine outside your home 
network.

If it doesn't happen, or you are not able to connect, there is something 
blocking the traffic. Not so relevant here maybe, but remember that 
outbound traffic can also be blocked.



-- 
Kristian

> 
> please help.
> Thanks,
> Varun.M
> 
> 
> Kristian Waagan-4 wrote:
>> musky wrote:
>>> I am trying to run the derby network server on one machine and trying to
>>> access the database on that machine from another machine.
>>>
>>> just for testing purposes,on the client program i give the IP address of
>>> the
>>> server machine(found out by going to findmyip.com).
>>>   
>> Hello,
>>
>> As I'm sure you know, opening the database up to Internet access has 
>> some security implications.
>> Now, if you want to do it, there are two things that must be done:
>>  1) Make sure the traffic can reach your database host from the Internet
>>     (depending on your network setup, this might include 
>> router/modem/firewall configuration etc)
>>  2) Make the Derby network server accept connection from the outside.
>>
>> Regarding point 2, by default Derby only allows connections from the 
>> local host. You can change this with the -h option, specifying an IP 
>> address or a host name. There is also a special value you can specify, 
>> which makes Derby listen to / accept everything.
>>
>>
>> hope this helps,
>> -- 
>> Kristian
>>
>>> When i try to connect using DriverManager.getconnection(URL),it gives me
>>> the
>>> following stacktrace:
>>>
>>> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
>>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>>> port
>>> 1527 with message Connection refused: connect.
>>> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
>>> Error connecting to server 59.96.37.195 on port 1527 with message
>>> Connection
>>> refused: connect.
>>> 	at
>>> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
>>> Source)
>>> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown
>>> Source)
>>> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
>>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>>> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>>> Caused by: org.apache.derby.client.am.DisconnectException:
>>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>>> port
>>> 1527 with message Connection refused: connect.
>>> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
>>> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
>>> 	at
>>> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>>> Source)
>>> 	... 13 more
>>> Caused by: java.net.ConnectException: Connection refused: connect
>>> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
>>> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>> 	at java.net.PlainSocketImpl.connect(Unknown Source)
>>> 	at java.net.SocksSocketImpl.connect(Unknown Source)
>>> 	at java.net.Socket.connect(Unknown Source)
>>> 	at java.net.Socket.connect(Unknown Source)
>>> 	at java.net.Socket.<init>(Unknown Source)
>>> 	at java.net.Socket.<init>(Unknown Source)
>>> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
>>> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
>>> 	at java.security.AccessController.doPrivileged(Native Method)
>>> 	... 19 more
>>> java.lang.NullPointerException
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>>> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
>>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>>> port
>>> 1527 with message Connection refused: connect.
>>> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
>>> Error connecting to server 59.96.37.195 on port 1527 with message
>>> Connection
>>> refused: connect.
>>> 	at
>>> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
>>> Source)
>>> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown
>>> Source)
>>> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
>>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>>> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>>> Caused by: org.apache.derby.client.am.DisconnectException:
>>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>>> port
>>> 1527 with message Connection refused: connect.
>>> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
>>> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
>>> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
>>> 	at
>>> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>>> Source)
>>> 	... 21 more
>>> Caused by: java.net.ConnectException: Connection refused: connect
>>> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
>>> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>> 	at java.net.PlainSocketImpl.connect(Unknown Source)
>>> 	at java.net.SocksSocketImpl.connect(Unknown Source)
>>> 	at java.net.Socket.connect(Unknown Source)
>>> 	at java.net.Socket.connect(Unknown Source)
>>> 	at java.net.Socket.<init>(Unknown Source)
>>> 	at java.net.Socket.<init>(Unknown Source)
>>> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
>>> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
>>> 	at java.security.AccessController.doPrivileged(Native Method)
>>> 	... 27 more
>>> java.lang.NullPointerException
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at
>>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
>>> 	at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>>> 	at
>>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>>>   
>>
>>
> 


Re: Connecting to Derby Network Server through the Internet

Posted by musky <mu...@gmail.com>.
i have a name mapped to my IP address called "j2m3world.servehttp.com" using
a no-ip dynamic update client. 
 have added derby to the list of exceptions in windows firewall.
i have configured my modem to run in bridged mode,so there is no question of
forwarding ports.
i start derby with the option -h 0.0.0.0

but still nothing seems to work.

i dont know what more i have to do.

please help.
Thanks,
Varun.M


Kristian Waagan-4 wrote:
> 
> musky wrote:
>> I am trying to run the derby network server on one machine and trying to
>> access the database on that machine from another machine.
>>
>> just for testing purposes,on the client program i give the IP address of
>> the
>> server machine(found out by going to findmyip.com).
>>   
> Hello,
> 
> As I'm sure you know, opening the database up to Internet access has 
> some security implications.
> Now, if you want to do it, there are two things that must be done:
>  1) Make sure the traffic can reach your database host from the Internet
>     (depending on your network setup, this might include 
> router/modem/firewall configuration etc)
>  2) Make the Derby network server accept connection from the outside.
> 
> Regarding point 2, by default Derby only allows connections from the 
> local host. You can change this with the -h option, specifying an IP 
> address or a host name. There is also a special value you can specify, 
> which makes Derby listen to / accept everything.
> 
> 
> hope this helps,
> -- 
> Kristian
> 
>> When i try to connect using DriverManager.getconnection(URL),it gives me
>> the
>> following stacktrace:
>>
>> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>> port
>> 1527 with message Connection refused: connect.
>> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
>> Error connecting to server 59.96.37.195 on port 1527 with message
>> Connection
>> refused: connect.
>> 	at
>> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
>> Source)
>> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown
>> Source)
>> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>> Caused by: org.apache.derby.client.am.DisconnectException:
>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>> port
>> 1527 with message Connection refused: connect.
>> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
>> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
>> 	at
>> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>> Source)
>> 	... 13 more
>> Caused by: java.net.ConnectException: Connection refused: connect
>> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
>> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
>> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>> 	at java.net.PlainSocketImpl.connect(Unknown Source)
>> 	at java.net.SocksSocketImpl.connect(Unknown Source)
>> 	at java.net.Socket.connect(Unknown Source)
>> 	at java.net.Socket.connect(Unknown Source)
>> 	at java.net.Socket.<init>(Unknown Source)
>> 	at java.net.Socket.<init>(Unknown Source)
>> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
>> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	... 19 more
>> java.lang.NullPointerException
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>> port
>> 1527 with message Connection refused: connect.
>> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
>> Error connecting to server 59.96.37.195 on port 1527 with message
>> Connection
>> refused: connect.
>> 	at
>> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
>> Source)
>> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown
>> Source)
>> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>> 	at java.sql.DriverManager.getConnection(Unknown Source)
>> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>> Caused by: org.apache.derby.client.am.DisconnectException:
>> java.net.ConnectException : Error connecting to server 59.96.37.195 on
>> port
>> 1527 with message Connection refused: connect.
>> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
>> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
>> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
>> 	at
>> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
>> Source)
>> 	... 21 more
>> Caused by: java.net.ConnectException: Connection refused: connect
>> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
>> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
>> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>> 	at java.net.PlainSocketImpl.connect(Unknown Source)
>> 	at java.net.SocksSocketImpl.connect(Unknown Source)
>> 	at java.net.Socket.connect(Unknown Source)
>> 	at java.net.Socket.connect(Unknown Source)
>> 	at java.net.Socket.<init>(Unknown Source)
>> 	at java.net.Socket.<init>(Unknown Source)
>> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
>> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	... 27 more
>> java.lang.NullPointerException
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at
>> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
>> 	at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
>> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
>> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
>> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
>> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
>> 	at
>> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
>> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Connecting-to-Derby-Network-Server-through-the-Internet-tp17584140p17593553.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Re: Connecting to Derby Network Server through the Internet

Posted by Kristian Waagan <Kr...@Sun.COM>.
musky wrote:
> I am trying to run the derby network server on one machine and trying to
> access the database on that machine from another machine.
>
> just for testing purposes,on the client program i give the IP address of the
> server machine(found out by going to findmyip.com).
>   
Hello,

As I'm sure you know, opening the database up to Internet access has 
some security implications.
Now, if you want to do it, there are two things that must be done:
 1) Make sure the traffic can reach your database host from the Internet
    (depending on your network setup, this might include 
router/modem/firewall configuration etc)
 2) Make the Derby network server accept connection from the outside.

Regarding point 2, by default Derby only allows connections from the 
local host. You can change this with the -h option, specifying an IP 
address or a host name. There is also a special value you can specify, 
which makes Derby listen to / accept everything.


hope this helps,
-- 
Kristian

> When i try to connect using DriverManager.getconnection(URL),it gives me the
> following stacktrace:
>
> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
> java.net.ConnectException : Error connecting to server 59.96.37.195 on port
> 1527 with message Connection refused: connect.
> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
> Error connecting to server 59.96.37.195 on port 1527 with message Connection
> refused: connect.
> 	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> Source)
> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
> Caused by: org.apache.derby.client.am.DisconnectException:
> java.net.ConnectException : Error connecting to server 59.96.37.195 on port
> 1527 with message Connection refused: connect.
> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
> 	at
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
> Source)
> 	... 13 more
> Caused by: java.net.ConnectException: Connection refused: connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> 	at java.net.PlainSocketImpl.connect(Unknown Source)
> 	at java.net.SocksSocketImpl.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	... 19 more
> java.lang.NullPointerException
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
> Cannot load Databasejava.sql.SQLNonTransientConnectionException:
> java.net.ConnectException : Error connecting to server 59.96.37.195 on port
> 1527 with message Connection refused: connect.
> java.sql.SQLNonTransientConnectionException: java.net.ConnectException :
> Error connecting to server 59.96.37.195 on port 1527 with message Connection
> refused: connect.
> 	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown
> Source)
> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
> 	at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at java.sql.DriverManager.getConnection(Unknown Source)
> 	at GUIModules.DataBaseClass.createConnection(DataBaseClass.java:31)
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:104)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
> Caused by: org.apache.derby.client.am.DisconnectException:
> java.net.ConnectException : Error connecting to server 59.96.37.195 on port
> 1527 with message Connection refused: connect.
> 	at org.apache.derby.client.net.NetAgent.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection.newAgent_(Unknown Source)
> 	at org.apache.derby.client.am.Connection.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
> 	at org.apache.derby.client.net.NetConnection40.<init>(Unknown Source)
> 	at
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(Unknown
> Source)
> 	... 21 more
> Caused by: java.net.ConnectException: Connection refused: connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> 	at java.net.PlainSocketImpl.connect(Unknown Source)
> 	at java.net.SocksSocketImpl.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at java.net.Socket.<init>(Unknown Source)
> 	at javax.net.DefaultSocketFactory.createSocket(Unknown Source)
> 	at org.apache.derby.client.net.OpenSocketAction.run(Unknown Source)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	... 27 more
> java.lang.NullPointerException
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:108)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at
> GUIModules.GeneralLoginGUIClass$2.widgetSelected(GeneralLoginGUIClass.java:138)
> 	at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
> 	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
> 	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> 	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
> 	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
> 	at GUIModules.ShellClass.eventloop(ShellClass.java:53)
> 	at
> GUIModules.GeneralLoginEventLoop.generalloginshelleventloop(GeneralLoginEventLoop.java:28)
> 	at GUIModules.DefaultMain.main(DefaultMain.java:11)
>