![]() |
IT-Interview.com:Open Database for IT Professionals to share interview questions, answers and knowledge. |
![]() |
IT-Interview.com:Open Database for IT Professionals to share interview questions, answers and knowledge. |
How can i connect oracle database from java program ? explain the steps with one example?
asked by: mr_oizo on: Apr 25, 2009
Best Answer ! ! !
DriverManager.registerDriver(new Oracle:jdbc:OracleDriver());Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "scott", "tiger");
alex_sin answered on£ºApr 26, 2009 0 comments
Steps to follow in creation of JDBC program-
hew answered on£ºApr 27, 2009 0 comments 
Class.forName ( oracld.jdbc.driver.OracleDriver );
Connection con DriverManager.getConnection ( jdbc:oracle:thin@localhose:1521:xe scott tiger );
xe is for oracle 10g
orcl is for oralce 8i and 9i
pamelaesther answered on£ºApr 28, 2009 0 comments
Hi friends Class.forName( oracle:jdbc:driver.OracleDriver );Connection c DriverManager.getConnection( jdbc:oracle:thin:@localhost:1521:myoracle scott tiger );scott-usernametiger-passwordmyoracle-SID nameSid name we are giving at the time of oracle install.In oracle 8i we can convert classes111.zip into classes111.jar and put at server lib in tomcat.In oracle 9i we can convert classes12.zip into classes12.jar and put at server lib in tomcat.
hazeynut answered on£ºApr 29, 2009 0 comments
import java.io.DataInputStream;import java.sql.DriverManager;import java.sql.Connection;import java.sql.Statement;import java.sql.SQLException;public class CRUDOperations{ public static void main(String raghu[])throws SQLException { Connection con null; try { DataInputStream dis new DataInputStream(System.in); Class.forName( oracle.jdbc.driver.OracleDriver ); con DriverManager.getConnection( dburl user pswd ); Statement st con.createStatement(); System.out.println( Enter the Employ id : ); int id Integer.parseInt(dis.readLine()); System.out.println( Enter the Employ Name : ); String name dis.readLine(); System.out.println( Enter the Employ salary : ); float salary Float.parseFloat(dis.readLine()); st.executeUpdate( insert values into Employee(id 'name' salary) ); } catch(Exception e) { e.printStackTrace(); } finally { con.close(); } }}
dominiquekay answered on£ºApr 30, 2009 0 comments
Close the Statement and the ResultSet as wel not only the Connection object.
ahbinbin answered on£ºMay 1, 2009 0 comments
Hello all
mrjustice answered on£ºMay 2, 2009 0 comments