get Connection jdbc:odbc Bridge - Java java.sql

Java examples for java.sql:ODBC

Description

get Connection jdbc:odbc Bridge

Demo Code


//package com.java2s;
import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getConnection());
    }/*from  www.ja va 2 s . c  om*/

    public static Connection getConnection() {
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con = DriverManager
                    .getConnection("jdbc:odbc:MusicOnlineStore");
            return con;
        } catch (Exception ex) {
            return null;
        }
    }
}

Related Tutorials