File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes JDBC /ODBC connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC /ODBC connectivity" Watch "JDBC /ODBC connectivity" New topic

JDBC /ODBC connectivity

nachiket deshpande
Ranch Hand

Joined: Oct 06, 2000
Posts: 114
Hi all!
I am new to JDBC forum.i have oracle 7 on my machine.and want
to establish connectivity with my database.I have read JDBC2.0
from jdk1.3 but unfortunately i am not able to connect my data
with my java programme.can someone helpme with detailed
connectivity code.I dont think we need drivers to
be loaded for local programmes on machine??please help
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
If you are using Sun's JDBC-ODBC bridge driver, you will have to set up an ODBC DSN to your Oracle database, which will require that you have a driver present on your local machine. You would have that driver if you had the Oracle client installed. If you are saying that your machine is both the client and the server, then I would recommend that you not try to dink around with ODBC. Sun's driver is only a reference implementation anyway, and not suitable for deployment. You can go to Oracle's web site and download their pure Java JDBC driver for free. It will be faster and easier. Then all you have to do is unzip it into your classpath and import it into your class file. Be sure to take a look at the documentation while you are out there so you can note the correct URL for your JDBC driver and it's proper connect string.
nachiket deshpande
Ranch Hand

Joined: Oct 06, 2000
Posts: 114
Thanks Bodie!
At present i am using sun's jdbc dbc driver.and got the i want to insert a new row using moveToInsertRow () method but the error is ArrayIndexOutOfBound exception.Please code is
import java.sql.*;
public class jump{
public static void main(String[] args)throws SQLException,
String url="jdbc dbc:dsn_sample";
Connection con=DriverManager.getConnection(url,"scott","scott");
System.out.println("Connected to DB");
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("SELECT * FROM ball");
System.out.println("Successfully executed the query");
String s,s1;
while ( {
int i=rs.getInt("age");
System.out.println("ROW="+s +" "+i+ " "+s1);
I agree. Here's the link:
subject: JDBC /ODBC connectivity
It's not a secret anymore!