sun.jdbc.odbc.JdbcOdbcDriver : Java by API examples (example source code) » java.sql » Vendor Driver

Java by API
C++
Java Products
Java Articles
Java by API Home  »   java.sql   » [  Vendor Driver  ]   
 



sun.jdbc.odbc.JdbcOdbcDriver

import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
  public static void main(String[] argsthrows Exception {
    String url = "jdbc:odbc:yourDBName";
    System.out.println("Attempting to connect to " + url);

    try {
      System.out.println("Loading the driver...");
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

      System.out.println("Establishing a connection...");
      Connection connection = DriverManager.getConnection(url);

      System.out.println("Connect to " + connection.getCatalog() " a success!");
    catch (Exception e) {
      e.printStackTrace();
    }
  }
}
Related examples in the same category
1.  org.hsqldb.jdbcDriver








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.