The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Connecting to a remote database

Posted by Chris Funkhouser on January 07, 2002 at 4:06 PM

I need some help in trying to connect my application to a remote database. I'm deploying my application over the Web through Java Web Start, which means a variety of clients need to be able to use it. It is likely that many of those clients have firewalls.

I downloaded a trial version of a Type 3 JDBC driver from IDS Software. I figured I would need to use the built-in proxy server that comes with it to get around the firewall issue. My code (the part that deals with this, anyway) looks like this, except with a real IP address put in where it says IPaddress. isdx.dll is their proxy server, and the variables and query are instantiated earlier in the code:

public void AuthConn() throws Exception {

Driver drv = new IDSDriver();
Connection conn =

drv.connect("jdbc:ids://IPaddress/scripts/idsx.dll/conn?dsn=IowaApplet", null);

ResultSet rs;
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,

ResultSet.CONCUR_READ_ONLY);

try {

String variable = Username.getText();
String query = "Select * from tblPassword WHERE Username = '" + variable + "'";
rs = stmt.executeQuery(query);

rs.next();
s = rs.getString("Username");
t = rs.getString("Password");
u = rs.getString("DistrictID");

Username.setText(s);
Password.setText(t);

} catch (SQLException e) {
e.printStackTrace();
}
stmt.close();
conn.close();
}

This code works fine when accessing it locally, but returns errors when trying to access it remotely. The usual and most common error is:

java.sql.SQLException: java.io.EOFException: Unexpected end of socket stream

Does anybody have experience with IDS driver/server in particular, or with another different driver that you know you can get to access a database remotely?

I'm currently using MS Access as the database, with a plan to move to MS SQL Server. My web server is running Windows 2000.

Any help on this topic is appreciated.

Thanks,
Chris



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us