Title: RE: How to connect to a remote database

You can simply point your system DSN to the remote DB and that will do it.

Jay Baker

-----Original Message-----
From: Jim Jones [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 08, 1999 10:15 PM
To: [EMAIL PROTECTED]
Subject: How to connect to a remote database


I can connect to a local access db with the following code:

  public void init(ServletConfig config) throws ServletException
  {
    super.init(config); //pass ServletConfig to parent

    try
    {
      //load JDBC-ODBC Bridge driver
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      //establish database connection to DataMart using ODBC
      dbConn = DriverManager.getConnection("jdbc:odbc:DataMart");
    }
    catch (ClassNotFoundException e) //Class.forName throws
    {
      System.out.println("JDBC-ODBC bridge not found!");
      return;
    }
    catch (SQLException e) //DriverManager.getConnection throws
    {
      System.out.println("Unable to open database!");
      return;
    }
  }

How do I modify this to connect to a remote database?

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to