I'm a recent (yesterday) convert from asp to jsp. I've had no difficulty
implementing a simple sql queries
with JDBC to return a result set but now I need to start hitting some of the
stored procedures I have written
here is the code. Where am I going wrong. I know it is the Execute() but
the documentation I have says
it should act the same as the executeQuery() I used with my simple queries.
Thanks for any help in advance.
<html>
<head>
<title>
Banners
</title>
<%@ page language="java"
import="java.sql.*,java.io.*,java.lang.*,java.util.*"%>
<body>
<h1>Banners</h1>
<table border="1" width="400">
<tr>
<td><b>ID</b></td><td><b>FileName</b></td>
</tr>
<%
// Load (and therefore register) the JDBC-ODBC Driver
Class.forName("intersolv.jdbc.sequelink.SequeLinkDriver");
// Get a Connection to the database
String url =
"jdbc:sequelink://209.xxx.x.xxx:xxxx/[SQLServer];xxxxxxx";
Connection conn = DriverManager.getConnection(url, "xxxxx",
"xxxxxxx");
//Create a Command object
String cmd = "{call sp_day_session_report(?}";
//Create a Callable Statement
CallableStatement cstmt = conn.prepareCall (cmd);
cstmt.setString(1, "11/11/00"); // EndDate of Report
cstmt.execute();
////////////////////////////////////////////////////////////////////////////
Here's where I think I'm screwing up
// Create a result set aka a Recordset
ResultSet rs = cstmt.execute();
// IF not null display results
if (rs != null) {
//Iterate through result set
while (rs.next()) {
String site_uid = rs.getString("site_uid");
String Site = rs.getString("Site");
%>
<tr>
<td><%=site_uid%></td>
<td><%=Site%></td>
</tr>
<%
} /* of while */
} /* of if */
cstmt.close();
conn.close();
%>
</table>
</body>
</html>
--------------------------------
Peter Jozsa
Developer,
Insite Communications
www.insitecom.com
1020 Bayridge
Kingston Ontario
K7P 2S2
1-613-384-3581
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets