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