Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is my URL - :) Determining db URL using SQL Plus

Status
Not open for further replies.

JProg

Programmer
Joined
Apr 4, 2002
Messages
88
Location
JP
Hi Everyone,

I need to determine the URL to use for connecting a Java Application I have written to an Oracle database. Usually when I connect to Oracle (of the 9i variety) I am using a web interface that has been provided for convenience.

Once at the URL I am presented with three pieces of information that I have to enter. As is the normal procedure a user name and password is required in addition to a Connection Identifier. As best I can tell the Connection Identifier is a SID (System Identifier).

My program compiles and will work once I have deciphered the URL. I am currently thinking that this web interface should not be my connection point for the standalone application I have written.

I have briefly looked at the simple UI that is provided with Oracle, the one called SQL Plus. Now I need to determine how the client SQL Plus actually connects to the database, particularly the URL and port that it connects on.

Obviously a default port (which slips my mind) is likely in use however I am hoping to get some help in working backwards from the SQL Plus client and determining the URL and Port that is being used.

I have quickly inspected SQL Plus and looked at the Help commands however nothing there will let me work out what I need to know.

Does anybody have any suggestions for determining the URL of a database given the SQL Plus client or perhaps using DOS and some antiquated networking commands?

Any help with this essoteric question will be greatly appreciated.

Regards

David
 
You should read about SQL*NET architecture. Briefly (just to obtain information you need now) you may find details in tnsnames.ora file located in folder defined by TNS_ADMIN environment variable. If not defined, it's defaulted to %ORACLE_HOME%\NETWORK\ADMIN (\NET80\ADMIN in 8.0.x ). You may find a name (so called TNS_ALIAS) that describes your connection.
About antiquated commands and quick inspection: IMO you're confusing modern knowledge with the superficial one.

Regards, Dima
 
depending on network and local machine set up, you could also use a DSN to link to the db...I have done this is a wondows (obviously) local machine connected to a unix os db platform

Cat, the other other white meat
 
Dima,

Thankyou for the invaluable advice. Using the tnsnames.ora file I was able to determine the host and other relevant information. I spent a good hour and a half getting the connection going because the format of the JDBC connection URL was not that shown on many of the Oracle information pages and not that shown on the Sun Java Tutorial for JDBC.
However I did find a very useful doc after searching out the error codes that I was recieving in my code. The URL for this page is:


This is particularly insightful if you are experiencing any difficulties in future. Thank you very much for your help.

Regards

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top