Program for
Java Data Base Connectivity.
import jawa.sql.*;
class
customer
{
Public static void main(String s[])throws SQLException
{
Driver
Manager.registerDriver(new Oracle.jdbc.OracleDrive( ));
System.out.println(“Connectiong
to the databace. . . . . . . . . . “);
try
{
Connection cn
=DriverManger.getConnection(“jdbc:
oracle: thin: @
prakash:
1521: orc
11”,”charu”,”charu”);
Statement st=
cn.CrateStatement( );
ResyltSet rs= st.Excute Querty(“Select ‘Connected’ from
dual”);
rs.next( );
String s= retString(1);
System.out.println(s);
St.close( );
Cn.close( );
}
Catch(Exception e)
{
System.out.println(“The
exception raised is:”+ ex);
}
}
}
Output is
Connecting
to database………
Connected
0 Comments
Please share your opinions and suggestions with us.