db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: Connecting to Derby Network Server through the Internet
Date Sun, 01 Jun 2008 13:08:59 GMT
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)
>   


Mime
View raw message