Hi!
I am having a problem with JDBC. I am trying to
connect to database using JDBC driver but I am not
able to . I tried to connect using the JDBC-ODBC
Bridge and it was successful. I am pasting the code
here ...please tell me where I am going wrong.
------------------------------------------------------
public void setData (String content) {
String qs = "Insert into news2(id,body) values(4,'"
+ content + "');";
try {
String url = "jdbc:odbc:192.68.0.4";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException ex) {
System.err.println("Cannot find the DB driver
classes.");
System.err.println(ex); }
Connection con =
DriverManager.getConnection(url,"gfe_mop","id");
Statement stmt = con.createStatement();
stmt.executeQuery(qs);
con.close();
}
catch (SQLException ex)
{ System.out.println ("SQLException:");
while (ex != null)
{
System.out.println ("SQL: " + qs);
System.out.println ("SQLState: " +
ex.getSQLState());
System.out.println ("Message: " + ex.getMessage());
System.out.println ("Vendor: " + ex.getErrorCode());
ex = ex.getNextException(); System.out.println ("");
}
}
}
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets