I'm trying to return a recordset via an Oracle 8.1.5 stored procedure.
I could swear that the following script used to work, but it now gives
an ArrayIndexOutOfBounds exception. This is using tomcat 3.2. (I haven't
figured out what's wrong yet, so I haven't mvoed it to Tomcat 4.01.)
What has me scratching my head is the fact that I'm not using an array
anywhere. I do not declare or initialize an array anyplace,
so what's the source of this error? Any push in the right direction
will be greatly appreciated. Thanks!
Henry
=============================================================
<%@ page language="java"
import="java.sql.*, java.text.*, java.util.*, oracle.jdbc.driver.*" %>
<html>
<head>
<title>JDBC —Oracle Connectivity Test</title>
</head>
<body BGCOLOR="WHITE">
<%
CallableStatement callStmt;
Connection objConn = null;
ResultSet objRs = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch (ClassNotFoundException cnfe) {
out.println(cnfe.getMessage());
cnfe.printStackTrace();
}
try {
// Make a connection to the ODBC data source
objConn = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:yankee", "scott", "tiger");
String query = "begin :1 := GetRecs.get_InvRecs; end;";
callStmt = objConn.prepareCall(query);
callStmt.registerOutParameter(1, OracleTypes.CURSOR);
callStmt.execute();
objRs = (ResultSet)callStmt.getObject(1);
}
catch (SQLException sqle) {
out.println(sqle.getMessage());
sqle.printStackTrace();
}
catch (Exception e) {
out.println(e.getMessage());
e.printStackTrace();
}
%>
<hr width='100%' size='3' noshade color="#800080">
<br>
<FONT color="#000080" face="Arial" size="+2">
<div align="center">Oracle Data Test - Inventory<BR>
This is a test.
</div>
</FONT>
<br>
<!-- Add an HTML table to format the results -->
<table border="1" align="center" cellpadding="2">
<!-- These are the column headings -->
<tr bgcolor="CYAN">
<!-- <th><font color='NAVY' face='Arial'>Mfg. name</font></th> -->
<th><font color='NAVY' face='Arial'>Model</font></th>
<th><font color='NAVY' face='Arial'>Year<BR>id#</font></th>
<th><font color='NAVY' face='Arial'>Mileage</font></th>
</tr>
<%
// Iterate through the result set to display all selected records
while (objRs.next()) {
System.out.println(objRs.getString(1));
}
%>
</table>
<br>
</BODY>
</HTML>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com