HI,
I am trying to connect the
applet with the oracle database... I have tried using all different tactics....and it is giving me different problems all the time....CAn some one help me out....
TIA. The code is as under.....
if(evt.target ==Button7)
{
System.out.println("Button Pressed");
//
String query = "(INSERT INTO LANDMARK VALUES('null', 'null', 'null', 'null'))";
//*********************************Make connection with the database
try {
txtfield.setText(null);
if (conn == null)
{
txtfield.append("Loading
JDBC dirver " + "oracle.jdbc.driver.OracleDriver()" + "\n");
//Driver driver=(Driver)Class.forName("oracle.jdbc.driver.OracleDriver()").newInstance();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("Registering the driver");
//Class.forName("oracle.jdbc.driver.OracleDriver");
txtfield.append("Connecting to the database" +" jdbc
racle
ci8:webhiqs/donotenter@diglib1$
conn = DriverManager.getConnection ("jdbc
racle:thin:@(description=(address=(host= diglib1.cecs.missouri.edu)(protocol=tcp)
(port=1521))(connect_data=(sid=medbio)))", "webhiqs", "donotenter");
//Connection conn=DriverManager.getConnection("jdbc
racle
ci8:webhiqs/donotenter@diglib1.cecs.missouri.edu:1521:medbio");
//Connection conn=DriverManager.getConnection("jdbc
racle:thin:@diglib1.cecs.missouri.edu:$
txtfield.append("Connected" + "\n");
System.out.println("Registering the driver");
} // if ends..................................
System.out.println("CONNECTED TO THE DATABASE");
// String query = ("INSERT INTO LANDMARK" + " VALUES('null', 'null', 'null', 'null'))";
Statement stmt = conn.createStatement();
txtfield.append("Executing query " + query + "\n");
ResultSet rset=stmt.executeQuery(query);
while (rset.next())
txtfield.append(rset.getString(1) + "\n");
// if(state3.executeUpdate(query)>0)
// {
System.out.println("the followed row is inserted");
// }
// else
// {
// System.out.println("out of the if loop");
// }
// state3.close();
}catch (NoClassDefFoundError etc) {etc.printStackTrace();
} catch (SQLException se) {se.printStackTrace();
} catch (Exception e) {e.printStackTrace();} // try-catch ends......................
System.out.println("Out of try block");
txtfield.append("Out of try block ");
}//end of submit button ..................