This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC-Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC-Oracle" Watch "JDBC-Oracle" New topic
Author

JDBC-Oracle

fei long
Ranch Hand

Joined: Apr 04, 2002
Posts: 48
i have a few questions about JDBC and Oracle, please help me. thanks.
1. What is the DB name? How can i know it.
2. i want to connect the oracle db throuhg java, but i always got exception(Connection refused). Following is the code snip.
--------------------------------------------
Class.forName ("oracle.jdbc.driver.OracleDriver");
System.out.println( "Driver loaded!" );
Connection conn =
DriverManager.getConnection ("jdbc:oracle:???:@???", "scott", "tiger")
---------------------------------------------
please tell me what should i fill in '?' place.
I ma using oracle8.0.5, and win2k.
thanks
[ Edited to fix ]
[ April 11, 2002: Message edited by: David O'Meara ]
Beksy Kurian
Ranch Hand

Joined: Jul 11, 2001
Posts: 254
jdbc:oracle:thin:@youripaddress:1521:youroraclesid
provided you have Oracle thin driver installed
Hope it helps!
Beksy
[ Edited to fix ]
[ April 11, 2002: Message edited by: David O'Meara ]
kris iyer
Greenhorn

Joined: Mar 27, 2002
Posts: 5
Hi
For running the jdbc type 4 driver you may have to add the classes111.zip or classes12.zip to ur classpath
DB name is the database name to which you r connecting. you can get it from the TNSname.ora
bye

kris
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"ordin",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
weiliu lili
Ranch Hand

Joined: Apr 11, 2002
Posts: 46
how do i check my oracle sid
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Should be "orcl" by default.
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
If that doesn't work, try going to Services in Administrative Tools from Control Panel and scroll down until you see the Oracle services. From there, you should be able to determine the SID.
fei long
Ranch Hand

Joined: Apr 04, 2002
Posts: 48
yes, yes.
i really tried those ways, but i failed.
java always give me 'java.sql.SQLException: Connection refused'
Is there any way to check if i can connect to oracle db?
thanks.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by ordin:
yes, yes.
i really tried those ways, but i failed.
java always give me 'java.sql.SQLException: Connection refused'
Is there any way to check if i can connect to oracle db?
thanks.

connect via SQL*Plus editor. Use the same parameters in your connection. This should eliminate any permission problems/naming problems.
Jamie
fei long
Ranch Hand

Joined: Apr 04, 2002
Posts: 48
hello Jamie,
could you tell me how to do in detail?(i mean step by step)
 
 
subject: JDBC-Oracle
 
Similar Threads
JDBC connect to Oracle 11g
Query regarding connection string.
db for jdbc
jdbc connection in Idea
JDBC connection in Oracle db