04 | import oracle.jdbc.pool.OracleDataSource; |
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 ); |
14 | ods.setPassword( password ); |
15 | Connection conn = ods.getConnection( ); |
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( ) + "%'" ; |
23 | ResultSet rset = stmt.executeQuery( query ); |
24 | while ( rset.next( ) ) |
25 | System.out.print( rset.getString( 1 )); |
29 | catch ( SQLException ex ) { |
30 | System.out.println( ex ); |
|