Share on Google+Share on Google+

JDBC-Odbc Connection

JDBC-ODBC Connection is a JDBC driver that translates the operation in JDBC into ODBC. For ODBC,it is a normal java application program.

JDBC-ODBC Connection


JDBC-ODBC Connection is a JDBC driver that translates the operation in  JDBC into ODBC. For ODBC,it is a normal java application program. This bridge provides JDBC  for database in which an ODBC driver is available. The bridge is represented as sun.jdbc.odbc.The Java contain a defined package and its library to access ODBC.

Understand with Example

In this Tutorial we help you in explaining JDBC Odbc Connection in Java. The code explains you a how creation and closing of connection is done. For this code we have a   JdbcOdbc Connection class. The class contains a main method, that include a list of steps as follow -

   Loading a driver is the first step to be done inside the try block of main method ( ) by calling a Class.forName ( ),this class accept a "sun.jdbc.odbc.jdbcodbc Driver" as argument.

   DriverManager.getConnection ( ) : This establish or built a connection between url and emp table in the database.

 The print print the "New Connection Create..."..The Connection object call a close ( ),return you the connection is closed. The println show the "Connection closed"

In case the exception exists in a try block, the subsequent catch block check and handle the exception.

import java.sql.*;

public class JdbcOdbcConnection {

  public static void main(String args[]) {

  Connection con = null;

  try {


  con = DriverManager.getConnection("jdbc:odbc:emp");

  System.out.println("New Connection Create ....");


  System.out.println("Connection closed");

  catch (Exception e) {







New Connection Create ....
Connection closed

Download code



Posted on: November 19, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: JDBC-Odbc Connection  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
January 24, 2013

December 24, 2011

it goods
January 14, 2012
jdbc-odbc connection

sir..when i am making connection with my database table and running my programm in eclipse,then i m getting my frame but cant submit into my database.. i am getting a message like "cannot find output table student".. pls help me sir...thanks
April 1, 2012
getting error

getting error at cannot connect http://localhost:8080
July 14, 2012
Driver Problem with JDBC

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified . when i try your program above error shown in cmd . i m using window 7 64bit Home Basic .plz help me out .
Rizwana Perveen
April 6, 2013
jdbc-odbc connectivity for windows7

please can any one can tell how to connect jdbc to odbc for windows7.My project is struct in that
July 10, 2013

thank u