|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Quote:
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'. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > How to connect Oracle with Java program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|