Java JDBC Connection Create getJdbcOdbcConnection()

Here you can find the source of getJdbcOdbcConnection()

Description

get Jdbc Odbc Connection

License

Open Source License

Declaration

public static Connection getJdbcOdbcConnection() throws SQLException,
            ClassNotFoundException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static Connection getJdbcOdbcConnection() throws SQLException,
            ClassNotFoundException {
        String odbcDataSourceName = "test1";
        String userName = "test1";
        String password = "test1";
        return getJdbcOdbcConnection(odbcDataSourceName, userName, password);
    }//from w  w w  .  j  ava 2  s.  co  m

    public static Connection getJdbcOdbcConnection(
            String odbcDataSourceName, String userName, String password)
            throws SQLException, ClassNotFoundException {
        Class.forName("sun.jdbc.odbc.JdbcDriver");

        String connectionURL = "jdbc:odbc:test1";
        Connection conn = DriverManager.getConnection(connectionURL,
                userName, password);
        return conn;
    }
}

Related

  1. getConnection(String username, String password, String driver, String url)
  2. getConnection2()
  3. getConnections(String driver, String url, String user, String pwd)
  4. getConnectionWithTransaction(String dbUrl, String dbUser, String dbPassword)
  5. getDBConnection()
  6. getNewConnection()
  7. getPhoenixConnection()
  8. getSourceConnection(final Hashtable env)
  9. getStatement(Map config)