Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 7th, 2004, 02:35 AM
asty asty is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 95 asty User rank is Private First Class (20 - 50 Reputation Level)asty User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 16 h 10 m 28 sec
Reputation Power: 5
How to connect Oracle with Java program

HI,
I am asking a very basic thing. So please help me.
I have installed Oracle 9i on my system. I want to access the Oracle Database ( create table, access tabeles etc.) from my java program using JDBC API.
I don't know what to give in DriverManager.getConnection.
DriverManager.getConnection("what here ?" , "username","pwd")

Do we need to give System IP address or anything else.

Please help me. Thanks
Asty

Reply With Quote
  #2  
Old November 7th, 2004, 03:18 AM
aamirk aamirk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 aamirk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by asty
I have installed Oracle 9i on my system. I want to access the Oracle Database ( create table, access tabeles etc.) from my java program using JDBC API.
I don't know what to give in DriverManager.getConnection.
DriverManager.getConnection("what here ?" , "username","pwd")
Asty


The value of "what here" (called URL) depends on the type of JDBC driver you use, "Thin" or "OCI" - both ship with Oracle 9i.

Thin driver:
jdbc:oracle:thin:@<machineName>:<port>:<SID>
example: jdbc:oracle:thin:@localhost:1521:GlobalDbSid

OCI:
jdbc:oracle:oci8:@<db_name from init.ora OR tnsnames.ora entry>
example: jdbc:oracle:oci8:@globaldb

SEE:
- Attached java example (connects to database and displays some database metadata) to confirm Db connectivity via JDBC (rename from .txt to .java). Note to run this example, the appropriate Oracle JDBC driver needs to be in the CLASSPATH. I can run this successfully using the 'classes12.jar' from the 'jdbc/lib' folder under the 9i installation.
- 'jdbc/demo' folder under 9i installation for lots of Oracle/JDBC examples.
- Google with the search values 'oracle jdbc'.
Comments on this post
aditya1_in agrees: the test file really helped me a lot thanks
Attached Files
File Type: txt jdbc_test.txt (7.0 KB, 871 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > How to connect Oracle with Java program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT