aspose file tools*
The moose likes JDBC and the fly likes help in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "help in JDBC " Watch "help in JDBC " New topic
Author

help in JDBC

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
hi,
I have oracle 8,0,5 installed on windows 98 system.
i want to use the java-oracle JDBC driver in my java code.

could anyone tell me the steps how to do it and what drivers to download and how.
let the farce be with you
Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Originally posted by felix thomas:
hi,
I have oracle 8,0,5 installed on windows 98 system.
i want to use the java-oracle JDBC driver in my java code.

could anyone tell me the steps how to do it and what drivers to download and how.

Hi,
U can download the driver from http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/jdbc805samp/jdbc805samp.htm
Set the classpath to the driver...
U can use this test program to test:
import java.io.*;
import java.util.*;
import java.sql.*;
class DbOraTest {


public static void main(String[] args)throws PasswordException{

Properties x = new Properties();
x.put("user","scott");
x.put("password","tiger");

try{
String url= "jdbc racle:thin:@8.95.0.234:1521:IFXT";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(url, x);
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from news");

while(rs.next())
{
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
}

}
catch(Exception e){
System.out.println(e);
}
}

}

HTH

Mahesh
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I have this list of resources on hand so, here it is :
These should be all the Oracle resources you need to get started, get familiar with jdbc, trouble shoot your problems, and eventually become advanced!
download your oracle drivers and follow the download procedures
enable the client to connect(set environment)

To find all the Oracle specific code that you could ever need -->look for the "JDBC Samples" links
some more oracle code here
If you just want code snippets that explain various tasks.
if you come accross a problem, check this list before you post
if you come accross an Oracle SQLException, then you can investigate the ORA-XXXXX error messages and solutions here:
good luck,
Jamie
felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
thanks guys u are the best
 
Consider Paul's rocket mass heater.
 
subject: help in JDBC