Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 2nd, 2006, 07:50 AM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DB connection with Oracle using all 4 type drivers

Hi All,
I am beginer of Java. I want the basic steps of database connection with Oracle using all Type-1 to Type-4 driver. Or any link that can help me for this purpose.Thank you.
 
Old March 21st, 2006, 12:13 AM
Authorized User
 
Join Date: Mar 2006
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[u]Driver - 1</u>:-

import java.sql.*;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:rams", "scott", "tiger");
Statement stmt = con.createStatement();
ResultSet res = stmt.executeQuery("select * from students");
while(rs.next())
    System.out.println(res.getInt(1) +"\t"+ res.getString(2));
con.close();

[u]Driver - 4</u>:-

import java.sql.*;

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@loc alhost:1526:orcl", "scott", "tiger");






Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft OLE DB Provider for ODBC Drivers (0x8004 phantom3008 ASP.NET 1.0 and 1.1 Basics 6 April 25th, 2007 10:30 AM
Microsoft OLE DB Provider for ODBC Drivers phantom3008 Classic ASP Basics 6 March 15th, 2007 09:39 AM
shoot thid - jdbc drivers-connection pooling Mallik8 J2EE 0 April 30th, 2005 04:20 AM
Microsoft OLE DB Provider for ODBC Drivers surendran Classic ASP Databases 4 October 27th, 2003 10:23 AM
OLE DB Provider for ODBC Drivers error '80004005' Routhg Access ASP 2 June 11th, 2003 07:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.