Possible Software to Be Used (Cont.)


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

Author:    

           
01import  java.sql.*;
02import  java.io.*;
03import  oracle.jdbc.*;
04import  oracle.jdbc.pool.OracleDataSource;
05 
06class  JDBC {
07 public static void  main( String args[ ] ) throws SQLException {
08  String user     = "C##user_id";
09  String password = "password";
10  String database = "20.185.147.112:1521/xe";
11  OracleDataSource ods = new OracleDataSource( );
12  ods.setURL     ( "jdbc:oracle:thin:@" + database );
13  ods.setUser    ( user );
14  ods.setPassword( password );
15  Connection conn = ods.getConnection( );
16  try {
17   Statement stmt = conn.createStatement( );
18   String query = "select unique title from inventory i, table(i.authors) j where ";
19   for ( int i=0;  i<args.length;  i++ ) {
20    if ( i != 0 )  query += " or ";
21    query += "j.name like '%" + args[i].trim( ) + "%'";
22   }
23   ResultSet rset = stmt.executeQuery( query );
24   while ( rset.next( ) )
25    System.out.print( rset.getString( 1 ));
26   rset.close( );
27   stmt.close( );
28  }
29  catch ( SQLException ex ) {
30   System.out.println( ex );
31  }
32  conn.close( );
33 }
34}




      Haste makes waste.