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 inventory i, table(i.authors) j where ";
   for ( int i=0;  i<args.length;  i++ ) {
    if ( i != 0 )  query += " or ";
    query += "j.name like '%" + args[i].trim( ) + "%'";
   }
   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( );
 }
}