File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Different Database Drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Different Database Drivers" Watch "Different Database Drivers" New topic
Author

Different Database Drivers

ashishk kumar
Greenhorn

Joined: Jan 29, 2008
Posts: 13
Hi,
I am new to JDBC API.....
I googled "JDBC Tutorials" and I got several tutorials, but they mainly describe the 4 types of drivers and shows an example using jdbc-odbc driver.
Can anyone please show/guide me to tutorials/code snippets where I can see the type 4 driver in use(because its the fastest and the best).

How do I connect to a databse (preferably Oracle) using the type 4 driver?

Thanks in advance,
Ashish
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8

There is no point looking for "Oracle JDBC" tutorials. Just take the tutorials you have already read and replace the line of code that loads the JDBC-ODBC driver by a very similar line of code that loads the Oracle driver. That's the only change necessary. JDBC was designed specifically so that you could plug in different database drivers without having to change any other code.
ashishk kumar
Greenhorn

Joined: Jan 29, 2008
Posts: 13
Yes but I am searching for "JDBC Tutorial" not "Oracle JDBC tutorials"

I know I can change the line where it says Class.forName("Oracle Class driver")
But I am trying to learn and know how to connect using driver 4 ? What would be the steps ?
Thanks,
Ashish
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

As Paul has already mentioned, there is no change. Change the driver class name and the JDBC URL and that is it. All your code will just work as is.

Check Oracle's JDBC documentation - its goes into quite a bit of detail.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different Database Drivers
 
Similar Threads
APPLETS with JDBC ODBC
SQL Server and real data type
JDBC DriverType & JTA
Example drivers for all the 4 types of JDBC Drivers
How to connect Oracle with Java