JDBCVersionApp.java Source code

Java tutorial

Introduction

Here is the source code for JDBCVersionApp.java

Source

/*
Java Programming with Oracle JDBC
by Donald Bales 
ISBN: 059600088X
Publisher: O'Reilly
*/

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

public class JDBCVersionApp {

    public static void main(String args[]) throws ClassNotFoundException, SQLException {

        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dssnt01:1521:dssora01", "scott", "tiger");
        DatabaseMetaData meta = conn.getMetaData();
        System.out.println("You're using version: " + meta.getDriverVersion() + " of the Oracle JDBC driver.");
        conn.close();
    }
}