Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to connect oracle with java
Posted

 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 12-Apr-11 8:19am    
Purrrfect! 5+
Chris Meech 12-Apr-11 8:23am    
How to Google. Great addition.
whenever you want connect to any database server you have to follow the 4 steps as:

1.Register the driver(Class.forName(driverName) here oracle driver name is :
oracle.jdbc.driver.OracleDriver)

2.Get the connection(DriverManager.getConnection(url, username, password) here oracle url is:"jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid)

3.Create a statement(Statement smt=con.createStatement())

4.Execute the query(optional)

5.Close the connections(con.close())

using those steps you can connect to any database in java
 
Share this answer
 
to connect oracle u have to perform 2 steps
1. Establish connection
a. loading drivers: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
b. making connection
Connection con=DriverManager.connection("jdbc:odbc:<dsnname","><username>","<password>");
2. executing statements.
Statement st=con.createStatement();
st.executeUpdate("create table xyz(no number);

Note: Based on Type on Driver
 
Share this answer
 
to connect oracle u have to perform 2 steps
1. Establish connection
a. loading drivers: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
b. making connection
Connection con=DriverManager.connection("jdbc:odbc:<dsnname","><username>","<password>");
2. executing statements.
Statement st=con.createStatement();
st.executeUpdate("create table xyz(no number);

Note: Based on Type one Driver
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900