<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
<HTML>
<Head>
<% @ Page
Language = "Java"
Import = "Java. SQL .*"
Contenttype = "text/html; charset = GBK"
Pageencoding = "GBK"
%>
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK">
<Meta name = "generator" content = "IBM WebSphere Studio">
<Meta http-equiv = "content-style-type" content = "text/CSS">
<Link href = "Theme/master.css" rel = "stylesheet" type = "text/CSS">
<Title> dbtest. jsp </title>
</Head>
<Body>
<P> employee list </P>
<Table border = 1>
<% String url = "JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = liveflow ";
String user = "sa"; // database username
String Password = "sa"; // Database User Password
String sqlstr = "select * From employee_base ";
Class. forname ("com. Microsoft. JDBC. sqlserver. sqlserverdriver ");
Connection con = drivermanager. getconnection (URL, user, password );
Statement ST = con. createstatement ();
Resultset rs = st.exe cutequery (sqlstr );
While (Rs. Next ())
{%>
<Tr> <TD> <% = Rs. getstring ("employee_id") %> </TD> <% = Rs. getstring ("employee_name") %> </TD> <% = Rs. getstring ("post_name") %> </TD> <% = Rs. getstring ("rela_phone") %> </TD> <% = Rs. getstring (6) %> </TD> </tr>
<% }%>
<%
Rs. Close ();
St. Close ();
Con. Close ();
%>
</Table>
</Body>
</Html>