import java.sql.*; import java.sql.*; import java.util.Properties; class myDatabase { private Connection conn; public void open() { Properties props = new Properties(); props.put("user", "njm"); props.put("password", "njm"); props.put("server", ""); try { java.sql.Driver d = (java.sql.Driver)Class.forName("weblogic.jdbc.oci.Driver").newInstance(); DriverManager.setLogStream(java.lang.System.out); conn = d.connect("jdbc:weblogic:oracle", props); } catch (Exception e) { System.err.println("Error connection: " + e);} } public void find(String word, StringBuffer s1, StringBuffer s2, StringBuffer s3) { try { System.out.println("name passed = " + word); PreparedStatement pstmt = conn.prepareStatement("select * from persontable where NAME = ?"); pstmt.setString(1,word); ResultSet rs = pstmt.executeQuery(); rs.next(); s1.append(rs.getString("NAME")); s2.append(rs.getString("AGE")); s3.append(rs.getString("OCCUP")); pstmt.close(); } catch (Exception e) { System.err.println("Error in dbase"); e.printStackTrace(); } } public void close() { try { conn.close(); } catch (Exception e) {System.err.println("Error in closing dbase");} } }