Simple Oracle Java Connection

import java.io.*;
import java.sql.*;

class oraclecon
{

public static void main(String argsp[])
{
try
{

Connection con = null;

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

con=DriverManager.getConnection("jdbc:oracle:thin:@snk:1521:database_name","scott","tiger");

Statement s=con.createStatement();

s.execute("select * from emp");

s.close();




}
catch(Exception e)
{


}


}



}



Thank You,

0 comments:

Post a Comment