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.


 

Ads

Tutorials   
JDBC Video Tutorial: Create, Read, Update and Delete (CRUD) Operation examples JDBC Video tutorial - How to read Data from MySQL Database? JDBC Video tutorial - How to delete Data in a MySQL Database? Solving java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception JDBC Video tutorial - How to update Data in a MySQL Database? JDBC Video Tutorial- How to insert data into MySQL database table? JDBC Video Tutorial: How to download JDBC Driver for MySQL? JDBC Tutorial - Writing first JDBC example and running in Eclipse Java Cross Join MySQL Database Connectivity Example In Java Change Column Name in MySQL Java Mysql Connection Example JDBC ODBC Connection In Java ResultSet In Java Prepared Statement Example JdbcRowSet interface Java JdbcRowSet Example First Step towards JDBC! JDBC Training, Learn JDBC yourself Jdbc Get Column Names JDBC Example with MySQL JDBC Prepared Statement Update JDBC Prepared Statement Insert JDBC Prepared Statement Example JDBC Prepared statement Close JDBC Prepared Statement Addbatch JDBC Nested Resultset JDBC-Odbc Connection JDBC-Odbc Connectivity JDBC Insert Preparedstatement JDBC Insert Null JDBC Get Metadata JDBC Insert Record Jdbc Insert Statement JDBC Meta Data Get tables Jdbc Mysql Connection String Jdbc Mysql Connection Url JDBC Next Jdbc Get Connection JDBC Get Int JDBC Exception JDBC Get Row Count JDBC Functions JDBC Fetch JDBC Execute Update Example JDBC Execute Statement JDBC Execute Query JDBC Drive For Mysql JDBC Connectivity Code In Java JDBC connection timeout
Ads

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. 

JdbcOdbcConnection.java

import java.sql.*;



public class JdbcOdbcConnection {



  public static void main(String args[]) {



  Connection con = null;





  try {



  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");



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



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

  con.close();

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



  catch (Exception e) {

  System.out.println(e);

  }



  }

}

  
 

Output

New Connection Create ....
Connection closed

Download code

Advertisements

Share on Google+Share on Google+

JDBC-Odbc Connection

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

Advertisements

 

Discuss: JDBC-Odbc Connection  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:7
ARUNKUMAR.J
January 24, 2013
jdbc

yes
bharath
December 24, 2011
java

it goods
hussain
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
Roshan
April 1, 2012
getting error

getting error at cannot connect http://localhost:8080
vijayratna
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 JdbcOdbcConnection.java 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
anis
July 10, 2013
code

thank u

Ads

 

Ads