<HTML>
<HEAD>
<title>Employee List</title>
</head>
<BODY>
<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<TABLE BORDER=1 width="75%">
<TR><TH>Last Name</TH><TH>First Name</TH></TR>
<%
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try{
// Load Oracle driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
String dbaddress = ("jdbcracle:thinmacha.wit.ie:1521:MACH"
conn = DriverManager.getConnection ("jdbcracle:thinmacha.wit.ie:1521:MACH", "W99418665","QEGXZA"
st = conn.createStatement();
rs = st.executeQuery("SELECT * FROM employees"
while (rs.next()) {
%>
<TR><TD><%= rs.getString("lname_txt" %></TD>
<TD><%= rs.getString("fname_txt" %></TD></TR>
<%
}
%>
</TABLE>
<%
} catch (Exception ex){
ex.printStackTrace();
%>
</table>
Oooops, something bad happened:
<%
} finally {
if (rs != null) rs.close();
if (st != null) st.close();
if (conn != null) conn.close();
}
%>
</BODY>