JDBC ODBC Bridge

In this chapter you will learn:

  1. How to work with ODBC through JDBC

Connect with ODBC

The following code shows how to make a connection to Access database using JDBC ODBC driver.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
//j a v  a2s .  c o m
public class Main {
  public static void main(String args[]) throws Exception {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String URL = "jdbc:odbc:dbName";
    Connection dbConn = DriverManager.getConnection(URL, "user", "pass");
    dbConn.close();

    PreparedStatement prepstmt;
    prepstmt = dbConn.prepareStatement("SELECT id FROM employee");
    prepstmt.execute();
    prepstmt.close();
    dbConn.close();
  }
}

Next chapter...

What you will learn in the next chapter:

  1. How to connect the HSQL memory based database
Home » Java Tutorial » Driver and Connection

Introduction

    JDBC

Driver

    Driver
    Driver Loaded
    Login Timeout
    Driver Available Parameters
    Driver version
    JDBC logging

Connection

    Connection
    Connection Properties
    Connection Charset
    JDBC ODBC Bridge
    HSQL memory based database

Database Meta Data

    All key words
    Table schema
    Table catalog
    Database version
    Database product version and name
    Data type information
    Transaction level
    Connection User name, URL and driver version
    All table names
    Get all column names
    Table existance
    System Functions Supported
    Date time function
    Numeric Functions Supported
    String functions
    Feature support
    Connection Limit
    Support Scrollable ResultSet