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 I have a question on connect to oracle 9i 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 "I have a question on connect to oracle 9i" Watch "I have a question on connect to oracle 9i" New topic

I have a question on connect to oracle 9i


Joined: Oct 02, 2002
Posts: 2
I use nt2000 sp3 and I want to use to connnect the oracle 9i which is installed on solaris 2.7 .
I have search a lot of the docs about this topic ,but i still have some question not been solved . Now states is
I can use the to connect to the other oracle on ntserver ,and the same been copied to solaris ,it can alse connect and query the data on either winnt and solaris oracle database. But ,I can't use my computer(winnt without installing oracle client )to connect to solaris oracle ,why ,I have configurate listern.ora and i make sure it is right. now i will show all the program to you ,give me some opinion please
package test;
import oracle.jdbc.*;
import java.sql.*;
public class Test {
public Test() {
public static void main(String[] args) {
Test test1 = new Test();
public void test(){
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc racle:thin:@"system":"manager");
Statement stmt = conn.createStatement();
/*ResultSet rs = stmt.executeQuery("select * from players");
ResultSet rs = stmt.executeQuery("select * from player");
// System.out.println(rs.getString("name"));
catch(Exception e){

sid_list_LISTENER =
(sid_list =
(sid_desc =
(sid_name = PLSExtProc)
(ORACLE_HOME = /export/home/Oracle/oraInventory/OraHome1
and i have make at the right place ,is anyone give me some reason please?
I am a chinese boy ,not very good at english ,
Thannnnnnnnnnk You!
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1793
Please adjust your displayed name to meet the JavaRanch Naming Policy. You can do so here.
Also, when posting large blocks of code, it's helpful to enclose them in UBB [ code ] [ /code ] tags.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

What is the SQLException being thrown? Where is it being thrown?
Not sure about your connection code. It should have the form
DriverManager.getConnection("jdbcracle:thin:@", "system", "manager");
if the above doesn't work, try connecting using the Oracle client ( sql*Plus editor ) to connect using the same connection parameters.
[ October 02, 2002: Message edited by: Jamie Robertson ]
John Carnell
Ranch Hand

Joined: Sep 27, 2002
Posts: 71
Hi Davis,
First of all your connect string is incorrect. The previous poster has a properly formatted "thin" client connect string.
Oracle has two types of drivers. The thick and the thin driver. The thick driver requires that that you have the Oracle SQL*NET Client installed on your machine and a tnsnames.ora file configured to connect to your database. The connect string is going to use the tnsnames.ora file entry to connect to the database.
The thin driver requires you to pass in a properly formatted string. The thin driver will open a socket and connect directly to the listener without the need for the underlying SQL*NET client.
Oracle has several decent pieces of JDBC examples on their web site and in their documentation. In addition, Wrox has a book called Oracle 9i Java Programming that covers the topic of JDBC in great deal. (As a piece of disclosure: I worked on the SQLJ chapter for that book. I dont get royalties from the book. I think the individual who wrote the JDBC chapters did a fantastic job.)
I hope that helps,
John Carnell

John Carnell<br />Principal Architect<br /> <br />Netchange, LLC<br />1161 HillCrest Heights<br />Green Bay, WI 54313<br /> <br /><br /> <br /> <br />Author of <a href="" target="_blank" rel="nofollow">Pro Jakarta Struts, Second Edition</a>
John Carnell
Ranch Hand

Joined: Sep 27, 2002
Posts: 71
Hi Davis,
One other thing. You should re-name your file to classes12.jar. I have run into problems with the Oracle JDBC drivers not being loaded because the class loader for the JVM will only pick a jar file and not a zip file.

John Carnell
I agree. Here's the link:
subject: I have a question on connect to oracle 9i
It's not a secret anymore!