[Java Programming] Program for Java Data Base Connectivity. [Science Tutor]

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


















Note : For Downloading Full Java Programming Practical File Click Here...

Post a Comment

0 Comments