Java Database Connectivity, a Java API for executing SQL statements. It consists of a set of
classes and interfaces written in the Java programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API.

JDBC 1.0 was more a proof of concept (or a proof of irritation) then anything else. With result sets only viewable once (once you moved on, the result was gone), limited querying capability, and you had to use java with it. Bah!

With JDBC 2.0, Sun Microsystems extended it enough to make it useful. Allowing Single, Multiple, and Procedural SQL (pronounced SQuir·reL) queries developers had a greater range of flexibility in development. Result sets could be viewed backwards and forwards multiple times.

The only problem is you still have to use that pesky java with it. I can't wait until retro brings back lisp as fashionable.

An example of a simple query using JDBC. The following example connects to Dr. Mischief's PostgreSQL database and lists all the evil schemes it can find.

Connection db;
Statement st;

String dbdriverobj = "org.postgresql.Driver";
String dburl =

try {
    // Load driver

    // Connect to the database
    db = DriverManager.getConnection(dburl);

    // Get political. Er, create object that holds the statement.
    st = db.createStatement();

    // Execute and get the results...
    st.execute("SELECT (date, details) FROM schemes;");
    ResultSet results = st.getResultSet();

    // Display results.
    while( {
	Object date = results.getObject(1);
	Object details = results.getObject(2);

        System.out.println(date + ": " + details);
} catch (ClassNotFoundException cnfe) {

     System.err.println("Class not defined (Is your SQL driver "+
                        "installed and on classpath?): "+cnfe);

} catch (SQLException se) {

     System.err.println("SQL error: "+se);

} catch (Exception e) {

     System.err.println("Error: "+e);


(Compare to DBI - yeah, these two are very similiar, don't you think?)

Log in or register to write something here or to contact authors.