Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

problem with JDBC connection

Thread view: 
prakash.mirji@gmail.com - 28 Jun 2007 19:50 GMT
Hello All,

i am using oracle.jdbc.driver.OracleDriver driver to connect to oracle
database.
And below is my tnsnames.ora file

ora2 =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = oracleHost)(Port = 1521))
   )
   (CONNECT_DATA = (SID = ora1))
 )

And in below line code of i use the instance name as ora1, my
connection will establish and i get the required output. However if i
use instance name as ora2 , i get SQL exception which says connection
didn't establish.

// Get a connection to the database
     Connection conn =
DriverManager.getConnection( "jdbc:oracle:thin:@oracleHost.xyz.com:
1521:" + "ora2", "user", "passwd") ;

I can't change ora2 as ora1 because the there are multiple entries in
the tnsnames.ora file which uses SID and outside block name same as
ora1 but its on different oracle host.

My question is :
for jdbc connection , i should use SID as ora1?. Please let me know.

Thanks & Regards,
Prakash
stefanomnn - 29 Jun 2007 11:47 GMT
> Hello All,
>
[quoted text clipped - 29 lines]
> Thanks & Regards,
> Prakash

hi, i should set ora1 in your connection string:  host:port:SID, it
doesn't matter name in tnsnames.ora

stefano


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.