|
I
wrote the following simple code to query a database
I use MS IIS and Jrun
When I browse this page I get the message
500 Internal Server ErrorJSP Parse ErrorJSP Directive <%@ %> contenttypeis not recognized. Does anyone knows soemthing about it?
<html>
<head>
<title>New Page 1</title> </head> <body>
<%@ page contentType="text/html;
charset=windows-1253" %>
<% Connection dbCon;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); dbCon = DriverManager.getConnection("jdbc:odbc:cafejava","",""); Statement stmt=null; ResultSet rs=null; String m_name=null; int numColumns=0; ResultSetMetaData rsmd =null; StringBuffer qry = new StringBuffer(1024); qry.append("Select * from Persons"); stmt=dbCon.createStatement(); rs=stmt.executeQuery(qry.toString()); rsmd=rs.getMetaData(); numColumns=rsmd.getColumnCount(); %> <TABLE BORDER="1" BGCOLOR="#cccc99" BORDERCOLOR="#003366"> <%
while(rs.next()) { %> <TR> <% for (int column=1;column<=numColumns;column++) { %> <TD><%= rs.getString(column) %></TD> <% } %> </TR> <% } %>
</body> </html>
Karkaletsis Kostas |
- Re: About JDBC - ODBC Kostas Karkaletsis
- Re: About JDBC - ODBC James Lee
