JDBC Applets through a proxy server

JDBC Applets through a proxy server

Post by Andreas Hube » Wed, 26 Nov 1997 04:00:00



    B) When I connect using IE 3.x and 4.x with the following configuration
     - Connect through a proxy server is enabled
     - Do not use proxy server for local intranets enabled
                - 172.17.50.244 is entered in the proxy exclusion list
         (P.S - The proxy server has Windows NT Challenge/Response enabled
and is configured
                     to allow inbound connections on port 1433)
         I get a message like this:
        "Exception while opening the socket on 172.17.50.244:1433
java.net.ConnectException: Connection refused"

    I think your trouble is you need an outbound permission to port 1433 (or
whichever other port you specifiy in the URL). All JDBC drivers will
initiate connection from the client side, that's why.

    An alternative is to use a public port like 23 for the database server
(provided you don't have telnet running on the server)

    Andreas

 
 
 

JDBC Applets through a proxy server

Post by Vinod Subramania » Thu, 27 Nov 1997 04:00:00


--------------71A64B5AA97D02E48C994E46
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I have the following test setup

172.17.50.244 is a NT 4.0 SP3 box running IIS 3.0 and SQL Server 6.5
listening on port 1433 and is
the intranet server

172.17.50.249 is a NT 4.0 SP3 box running Microsoft Proxy Server 2.0
which provides internet
connections for workstations on these networks 172.17.52.* and
172.17.51.*

I'm trying the following applet which uses Connect Software's type 4
JDBC driver:
(The applet resides on 172.17.50.244 along with Connect Software's JDBC
drivers.
The URL that I use to access the page is
http://172.17.50.244/jdbc/socketapplet.html)

import jdbc.sql.*;                  // FIXME: jdbc.sql or java.sql
import java.applet.*;               // applet class
import java.awt.*;                  // windowing toolkit
import java.io.*;                   // I/O classes and exceptions
import java.net.*;                  // TCP/IP libraries

public class ConnectionApplet extends Applet
{

    String url = "jdbc:ff-microsoft://172.17.50.244:1433";// FIXME:
jdbc:ff-microsoft://hostname:portnumber
    // String url = "jdbc:ff-sybase://gionata:5000";        // FIXME:
jdbc:ff-sybase://hostname:portnumber
    String login = "sa";                                    // FIXME:
your login (for system administrator use sa)
    String password = "";                                   // FIXME:
your password

    public void init()
    {
        System.getProperties().put("proxySet", "true");
        System.getProperties().put("proxyHost", "172.17.50.249");
        System.getProperties().put("proxyPort", "80");
        try
        {

Class.forName("connect.sybase.SybaseDriver");                       //
loads class by name and registers with driver manager
            Driver driver1 = new
connect.sybase.SybaseDriver();                 // also try creating a
class (redundant but useful for demo)
            Class.forName("connect.microsoft.MicrosoftDriver");
            Driver driver2 = new connect.microsoft.MicrosoftDriver();

            Connection connection =
DriverManager.getConnection(url,login,password);
            message = "Connection was opened with " + url;  //
connection was opened succesfully
            connection.close();                             // close the
connection (and its socket)
        }

        catch(ClassNotFoundException ex)
        {
            message = "Exception: Driver wasn't found, check classpath:
" + ex;
        }

        catch(Exception ex)
        {
            message = "Exception while opening the connection: " + ex;

            ex.printStackTrace(System.out);                 // prints
the stack trace which shows where the problem is
        }

        catch(Error err)
        {
            message = "Error while opening the connection: " + err;

            err.printStackTrace(System.out);                // prints
the stack trace which shows where the problem is
        }

        System.out.println(message);

        repaint();
    }

    public void paint(Graphics graphics)
    {
        graphics.drawString(message,10,20);
    }

    String message = "";

}

A) When I connect using Netscape Versions 3.0 and 4.x I face no problems
at all.

B) When I connect using IE 3.x and 4.x with the following configuration
 - Connect through a proxy server is enabled
 - Do not use proxy server for local intranets enabled
            - 172.17.50.244 is entered in the proxy exclusion list
     (P.S - The proxy server has Windows NT Challenge/Response enabled
and is configured
                 to allow inbound connections on port 1433)
     I get a message like this:
    "Exception while opening the socket on 172.17.50.244:1433
java.net.ConnectException: Connection refused"

C) When I connect using IE 3.x and 4.x without enabling the proxy I face
no problems at all

1) Is it possible for a JDBC applet to be accessed through a proxy
server ?

2) Will using the FastForward Security proxy make any sense since IIS
which is serving the applet
    and SQL Server reside on the same host i.e 172.17.50.244 ?

Vinod Subramaniam,
Systems Executive,
NIIT Limited,
F-90 /2 Okhla Ph-I
New Delhi
INDIA
Ph: 91-11-6817385-88
Fax: 91-11-6817384
E-mail: vin...@delf90.niit.co.in
web: http://www.niit.com
personal: http://www.geocities.com/SiliconValley/Way/2219/
                http://www.freeyellow.com/members/luckylipps/
---------------------------------------------------------------------------

A Peregrine for a Prince,
A Goshawk for a Bishop,
A Eagle for a Emperor,
A Falcon for a King,
A Kestrel for a Knave.
---------------------------------------------------------------------------

--------------71A64B5AA97D02E48C994E46
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<TT><FONT SIZE=-1>I have the following test setup</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>172.17.50.244 is a NT 4.0 SP3 box running IIS 3.0
and SQL Server 6.5 listening on port 1433 and is</FONT></TT>
<BR><TT><FONT SIZE=-1>the intranet server</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>172.17.50.249 is a NT 4.0 SP3 box running Microsoft
Proxy Server 2.0 which provides internet</FONT></TT>
<BR><TT><FONT SIZE=-1>connections for workstations on these networks 172.17.52.*
and 172.17.51.*</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>I'm trying the following applet which uses Connect
Software's type 4 JDBC driver:</FONT></TT>
<BR><TT><FONT SIZE=-1>(The applet resides on 172.17.50.244 along with Connect
Software's JDBC drivers.</FONT></TT>
<BR><TT><FONT SIZE=-1>The URL that I use to access the page is <A HREF="http://172.17.50.244/jdbc/socketapplet.html">http://172.17.50.244/jdbc/socketapplet.html</A>)</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>import jdbc.sql.*;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// FIXME: jdbc.sql or java.sql</FONT></TT>
<BR><TT><FONT SIZE=-1>import java.applet.*;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// applet class</FONT></TT>
<BR><TT><FONT SIZE=-1>import java.awt.*;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// windowing toolkit</FONT></TT>
<BR><TT><FONT SIZE=-1>import java.io.*;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// I/O classes and exceptions</FONT></TT>
<BR><TT><FONT SIZE=-1>import java.net.*;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// TCP/IP libraries</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>public class ConnectionApplet extends Applet</FONT></TT>
<BR><TT><FONT SIZE=-1>{</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; String url = "jdbc:ff-microsoft://172.17.50.244:1433";//
FIXME: jdbc:ff-microsoft://hostname:portnumber</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // String url = "jdbc:ff-sybase://gionata:5000";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// FIXME: jdbc:ff-sybase://hostname:portnumber</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; String login = "sa";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// FIXME: your login (for system administrator use sa)</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; String password = "";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// FIXME: your password</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; public void init()</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; {</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.getProperties().put("proxySet",
"true");</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.getProperties().put("proxyHost",
"172.17.50.249");</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.getProperties().put("proxyPort",
"80");</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Class.forName("connect.sybase.SybaseDriver");&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// loads class by name and registers with driver manager</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Driver driver1 = new connect.sybase.SybaseDriver();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// also try creating a class (redundant but useful for demo)</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Class.forName("connect.microsoft.MicrosoftDriver");</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Driver driver2 = new connect.microsoft.MicrosoftDriver();</FONT></TT><TT><FONT SIZE=-1></FONT></TT>

<P><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Connection connection = DriverManager.getConnection(url,login,password);</FONT></TT>
<BR><TT><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
message = "Connection was opened with " + url;&nbsp; // connection was
opened succesfully</FONT></TT> ...

read more »

 
 
 

JDBC Applets through a proxy server

Post by Vinod Subramania » Fri, 28 Nov 1997 04:00:00


I have configured the proxy to allow outbound connections on port
1433 which is the port that SQL Server listens on by default.

Further I have also included these three lines of code in my init()
method: (As mentioned in JavaWorld Tip 45)

  System.getProperties().put("proxySet", "true");
  System.getProperties().put("proxyHost", "172.17.50.249");
  System.getProperties().put("proxyPort", "80");

Now the question is why do I still get the same error ?
Do I need to set the proxy port to 1433 ?


>     B) When I connect using IE 3.x and 4.x with the following
> configuration
>      - Connect through a proxy server is enabled
>      - Do not use proxy server for local intranets enabled
>                 - 172.17.50.244 is entered in the proxy exclusion list

>          (P.S - The proxy server has Windows NT Challenge/Response
> enabled
> and is configured
>                      to allow inbound connections on port 1433)
>          I get a message like this:
>         "Exception while opening the socket on 172.17.50.244:1433
> java.net.ConnectException: Connection refused"

>     I think your trouble is you need an outbound permission to port
> 1433 (or
> whichever other port you specifiy in the URL). All JDBC drivers will
> initiate connection from the client side, that's why.

>     An alternative is to use a public port like 23 for the database
> server
> (provided you don't have telnet running on the server)

>     Andreas

 
 
 

JDBC Applets through a proxy server

Post by Andreas Hube » Sat, 29 Nov 1997 04:00:00


Vinod,
I am not really an expert in this, but I had the impression that you
addressed the problem of routing thru a firewall.
If this is a local problem (i.e. intranet) then I would more or less rule
out the proxy as a cause (the reason being that I doubt Java cares for the
browser proxy settings too much). I would first check if JDBC connections to
the server go thru outside the browser. I would try that incrementally
- running locally first with an application
- running locally in appletviewer
- running locally in the browser
- running remote with an application
- running remote from the browser

The results will give you clues where to find the problem (causes including
database middleware settings, server TCP/IP settings, client TCP/IP
settings, browser settings.
The reason for tests locally is to rule out possible DNS or LAN management
restrictions, the reasons for going to application is to rule out browser
influence and applet security (unlikely here though)

Andreas

Vinod Subramaniam schrieb in Nachricht

>I have configured the proxy to allow outbound connections on port
>1433 which is the port that SQL Server listens on by default.

>Further I have also included these three lines of code in my init()
>method: (As mentioned in JavaWorld Tip 45)

>  System.getProperties().put("proxySet", "true");
>  System.getProperties().put("proxyHost", "172.17.50.249");
>  System.getProperties().put("proxyPort", "80");

>Now the question is why do I still get the same error ?
>Do I need to set the proxy port to 1433 ?


>>     B) When I connect using IE 3.x and 4.x with the following
>> configuration
>>      - Connect through a proxy server is enabled
>>      - Do not use proxy server for local intranets enabled
>>                 - 172.17.50.244 is entered in the proxy exclusion list

>>          (P.S - The proxy server has Windows NT Challenge/Response
>> enabled
>> and is configured
>>                      to allow inbound connections on port 1433)
>>          I get a message like this:
>>         "Exception while opening the socket on 172.17.50.244:1433
>> java.net.ConnectException: Connection refused"

>>     I think your trouble is you need an outbound permission to port
>> 1433 (or
>> whichever other port you specifiy in the URL). All JDBC drivers will
>> initiate connection from the client side, that's why.

>>     An alternative is to use a public port like 23 for the database
>> server
>> (provided you don't have telnet running on the server)

>>     Andreas