Possible Software to Be Used (Cont.)


JDBC (Java DataBase Connectivity)
It is a Java application programming interface for standard SQL access to databases.

Author:    

           
import  java.sql.*;
import  java.io.*;
import  oracle.jdbc.*;
import  oracle.jdbc.pool.OracleDataSource;

class  JDBC {
 public static void  main( String args[ ] ) throws SQLException {
  String user     = "C##user_id";
  String password = "password";
  String database = "20.185.147.112:1521/xe";
  OracleDataSource ods = new OracleDataSource( );
  ods.setURL     ( "jdbc:oracle:thin:@" + database );
  ods.setUser    ( user );
  ods.setPassword( password );
  Connection conn = ods.getConnection( );
  try {
   Statement stmt = conn.createStatement( );
   String query   = "SELECT UNIQUE title FROM book b, author a, written w WHERE ";
   query         += "w.aid = a.aid AND w.ISBN = b.ISBN AND ( ";
   for ( int i=0;  i<args.length;  i++ ) {
     if ( i != 0 )  query += " OR ";
     query += "a.name like '%" + args[i].trim( ) + "%'";
   }
   query += " )";
   ResultSet rset = stmt.executeQuery( query );
   while ( rset.next( ) )
    System.out.print( rset.getString( 1 ));
   rset.close( );
   stmt.close( );
  }
  catch ( SQLException ex ) {
   System.out.println( ex );
  }
  conn.close( );
 }
}