JDBC Connections

How to connect Oracle DataBase through Java Program?
[59 byte] By [sudharsha] at [2007-11-15]
# 1
JDBC
jwentinga at 2007-7-12 > top of java,Core,Core APIs...
# 2
I need code.If possible send me the code.
sudharsha at 2007-7-12 > top of java,Core,Core APIs...
# 3
You need to write the code my friend. Look up the documentation. There are plenty of samples.
ejpa at 2007-7-12 > top of java,Core,Core APIs...
# 4
"Sorry boss, project isn't finished yet. I'm still waiting for the internet to write some code for me"as if.....
georgemca at 2007-7-12 > top of java,Core,Core APIs...
# 5

Class.forName ("oracle.jdbc.driver.OracleDriver");

Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@<HOST NAME>:<PORT>:<SID>", "USER","PASS");

Statement st = conn.createStatement();

ResultSet rs = st.executeQuery(" YOUR QUERY HERE- SELECT " )

OR

st.executeUpdate(" DML/DDL Statement");

Place classes12.zip in your classpath before execution

Arinjaya at 2007-7-12 > top of java,Core,Core APIs...
# 6
Class.forName("oracle.jdbc.driver.OracleDriver");Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","username","password");Statement stmt=con.createStatement();stmt.executeQuery("your query");con.close();
mcastudent_indiaa at 2007-7-12 > top of java,Core,Core APIs...