listemployees.ctf
#!/bin/sh /ss/bin/ss.exe
<%
loadDriver("sun.jdbc.odbc.JdbcOdbcDriver")
connection = getConnection("jdbc:odbc:iob", "", "")
statement = connection.createStatement()
resultSet = statement.executeQuery("select * from employees")
count = 0
%>
List Employees
First Name
|
Last Name
|
<%
do while resultSet.next()
count = count + 1
%>
<%=resultSet.getString("FirstName")%>
|
<%=resultSet.getString("LastName")%>
|
<%loop%>
<%if count = 0 then%>
no employees were displayed
<%elseif count = 1 then%>
one employee was displayed
<%else%>
<%=count%> employees were displayed
<%end%>
<%
resultSet.close()
statement.close()
connection.close()
%>