JSP notepad program

Source: Internet
Author: User
Tags getmessage odbc stmt
Package guestbook;
Import java. SQL .*;
Public class guestbook {
String sDBDriver = "sun. jdbc. odbc. JdbcOdbcDriver ";
String sConnStr = "jdbc: odbc: guestbook ";
Connection conn = null;
ResultSet rs = null;

Public guestbook (){
Try {
Class. forName (sDBDriver );
}
Catch (java. lang. ClassNotFoundException e ){
System. err. println ("guestbook ():" + e. getMessage ());
}
}
Public void executeInsert (String SQL ){
Try {
Conn = DriverManager. getConnection (sConnStr );
Statement stmt = conn. createStatement ();
Stmt.exe cuteUpdate (SQL );
}
Catch (SQLException ex ){
System. err. println ("guestbook.exe cuteUpdate:" + ex. getMessage ());
}
}
Public ResultSet executeQuery (String SQL ){
Rs = null;
Try {
Conn = DriverManager. getConnection (sConnStr );
Statement stmt = conn. createStatement ();
Rs = stmt.exe cuteQuery (SQL );
}
Catch (SQLException ex ){
System. err. println ("guestbook.exe cuteQuery:" + ex. getMessage ());
}
Return rs;
}
}
<Html>
<Head>
<Title> My First Jsp GuestBook </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<Body bgcolor = "# CCCCFF" vlink = "#000000" alink = "#666666">
<Div align = "center">
<P> <font size = "7"> <B> <font size = "+ 6"> Jsp GuestBook </font> </B> </font> </p>
<Form method = "post" action = "index. jsp">
<Table width = "75%" align = "center" border = 1>
<Tr>
& Lt; td width = "30%" & gt;
<Div align = "right"> Name: </div>
</Td>
& Lt; td width = "70%" & gt;
<Input type = "text" name = "name">
</Td>
</Tr>
<Tr>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.