Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC-Oracle

 
fei long
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i check my oracle sid
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should be "orcl" by default.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello Jamie,
could you tell me how to do in detail?(i mean step by step)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic