I need help with one of my JSP page. When I run it, it give me error with CURSOR STATE IS INVALID. But with the same JSP page, if I point to the production database, it working fine. This is going to replace the production database. Both of them have the same data model. Nothing change, is Peregrine AssetCenter Database.

Can you help please?

L.A

<html>

<body>

<% String AssetTagPrm = request.getParameter("AssetTagPrm");

AssetTagPrm = AssetTagPrm.toUpperCase();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String url = "jdbcdbcrogrin";
Connection conn = DriverManager.getConnection(url, "perwr12", "opedwxx");

Statement stmt2 = conn.createStatement();
Statement stmt3 = conn.createStatement();

String SQLstr = "Select amComputer.lComputerId,amAsset.assetTag, amEmpldept.UserLogin, amComputer.workgroup, amComputer.TcpIpAddress, amComputer.Dthardscan, " +
"amBrand.name brandname, amComputer.name computername, amComputer.lmemorysizeMB, amComputer.lDisksizeMB " +
", amComputer.cpuType, amComputer.lcpuspeedMhz,amComputer.lDiskSizeMb, amComputer.lFreespaceMB, " +
"OperatingSystem, OSServiceLevel SystemVersion " +
"from amAsset,amPortfolio, amModel, amEmplDept, amComputer, amBrand " +
"where amAsset.lAstId = amPortfolio.lAstID " +
"and amPortfolio.lModelId = amModel.lModelId " +
"and amComputer.lAstID = amAsset.lAstID " +
"and amPortfolio.lUserID = amEmplDept.lEmpldeptID " +
"and amBrand.lBrandID = amModel.lBrandId " +
"and upper(amAsset.AssetTag) = '" + AssetTagPrm + "'";

ResultSet rs1;
ResultSet rs2;
rs1 = stmt2.executeQuery(SQLstr);
rs1.next();

SQLstr = "Select ValString from amFVComputer, amFeature where amFVComputer.lFeatId = amFeature.lFeatId and amFVComputer.lcomputerId = " + rs1.getString("lComputerId") +
" and amFeature.textLabel = 'WS Server'";

rs2 = stmt3.executeQuery(SQLstr);
rs2.next();
%>
<table border="0" width="100%">
<tr>
<td width="25%" height="25"></td>
<td width="50%" colspan="2" height="25">
<p align="center"><b><font face="Book Antiqua" size="4">Workstation
Detail Report</font></b></td>
<td width="25%" height="25"></td>
</tr>
<tr>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
</tr>
<tr>
<td width="25%" height="24"></td>
<td width="50%" height="24" colspan="2" align="center"><b><font color="#0099FF">W<span style="font-variant: small-caps">orkstation</span></font></b></td>
<td width="25%" height="24"></td>
</tr>
<tr>
<td width="25%" height="24">&nbsp;</td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
</tr>
<tr>
<td width="25%" height="24"><b>Unique Identifier:</b></td>
<td width="25%" height="24"><%= rs1.getString("assetTag") %></td>

<td width="25%" height="24"><b>Memory Size:</b></td>
<td width="25%" height="24"><%= rs1.getString("lmemorysizeMB") %> MB</td>

</tr>
<tr>
<td width="25%" height="24"><b>Manufacturer:</b></td>
<td width="25%" height="24"><%= rs1.getString("brandname") %></td>

<td width="25%" height="24"><b>Disk Size:</b></td>
<td width="25%" height="24"><%= rs1.getString("lDiskSizeMb") %> MB</td>

</tr>
<tr>
<td width="25%" height="24"><b>CPU:</b></td>
<td width="25%" height="24"><%= rs1.getString("cpuType") + " " + rs1.getString("lcpuspeedMhz") + "MHz" %></td>
<td width="25%" height="24"><b>Available Disk Space:</b></td>
<td width="25%" height="24"><%= rs1.getString("lFreespaceMB") %> MB</td>
</tr>
</table>

<table border="0" width="100%" height="28">
<tr>
<td width="25%" height="24"></td>
<td width="50%" background="Web\Blue%20Line.bmp" height="24">&nbsp;</td>
<td width="25%" height="24"></td>
</tr>
</table>

<table border="0" width="100%" height=28 cellspacing=0>
<tr>
<td width="25%" height="4"></td>
<td width="50%" colspan="2" height="4">
<p align="center"><b><font size="3" color="#0099FF">N<span style="font-variant: small-caps">etwork</span></font></b></td>
<td width="25%" height="4"></td>
</tr>
</table>
<table border="0" width="100%" cellspacing=0>
<tr>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
</tr>
<tr>
<td width="25%" height="24"><b>Computer Name:</b></td>
<td width="25%" height="24"><%= rs1.getString("computername") %></td>
<td width="25%" height="24"><b>Domain:</b></td>
<td width="25%" height="24"><%= rs1.getString("workgroup") %></td>
</tr>
<tr>
<td width="25%" height="24"><b>User ID:</b></td>
<td width="25%" height="24"><%= rs1.getString("UserLogin") %></td>
<td width="25%" height="24"><b>WS Server:</b></td>
<td width="25%" height="24"><%= rs2.getString("ValString") %></td>
</tr>
<tr>
<td width="25%" height="24"><b>IP Address:</b></td>
<td width="25%" height="24"><%= rs1.getString("TcpIpAddress") %></td>
<td width="25%" height="24"><b>Date of Last Scan:</b></td>
<td width="25%" height="24"><%= rs1.getString("Dthardscan") %></td>
</tr>
</table>
<%
String OperatingSystem = rs1.getString("OperatingSystem") ;
String SystemVersion = rs1.getString("SystemVersion");

SQLstr = "Select amBrand.Name brandname, amModel.Name modelname, amModel.VersionLevel, amFVSoftInstall.Valstring Language " +
"From amPortfolio Software, amModel, amBrand, amSoftInstall, amPortfolio Parent, amFVSoftInstall " +
"Where Software.lModelId = amModel.lModelId " +
"And amModel.lBrandId = amBrand.lBrandId " +
"And Software.lPortfolioItemId = amSoftInstall.lItemId " +
"And Parent.lPortfolioItemId = Software.lParentId " +
"And amSoftInstall.lSoftInstId = amFVSoftInstall.lSoftInstId " +
"And amFVSoftInstall.lFeatId = (select lFeatID from amFeature where upper(TextLabel) = 'LANGUAGE') " +
"And Parent.AssetTag = '" + AssetTagPrm + "' order by 1,2,3,4";

rs1 = stmt2.executeQuery(SQLstr);
%>


<table border="0" width="100%" height="28">
<tr>
<td width="25%" height="24"></td>
<td width="50%" background="Web\Blue%20Line.bmp" height="24">&nbsp;</td>
<td width="25%" height="24"></td>
</tr>
</table>

<table border="0" width="100%" height=28 cellspacing=0>
<tr>
<td width="25%" height="4"></td>
<td width="50%" colspan="2" height="4">
<p align="center"><b><font size="3" color="#0099FF">S<span style="font-variant: small-caps">oftware</span></font></b></td>
<td width="25%" height="4">&nbsp;</td>
</tr>
<tr>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
<td width="25%" height="24"></td>
</tr>
<tr>
<td width ="25%" height="24"><B>Operating System:</B></td>
<td width ="25%" height="24"><%=OperatingSystem %></td>

</tr>

<tr>
<td width ="25%" height="24"><B>Version:</B></td>
<td width ="25%" height="24"><%=SystemVersion %></td>

</tr>
<tr><td>&nbsp;</td></tr>
</table>

<table border="1" width="100%" cellspacing=0>

<tr>
<td width="25%" height="24"><b>Publisher</b></td>
<td width="25%" height="24"><b>Application</b></td>
<td width="25%" height="24"><b>Version</b></td>
<td width="25%" height="24"><b>Language</b></td>
</tr>
<% while (rs1.next())
{ %>
<tr>
<td width="25%" height="24"><%= rs1.getString("brandname") %></td>
<td width="25%" height="24"><%=rs1.getString("modelname")%></td>
<td width="25%" height="24"><%=rs1.getString("VersionLevel")%></td>
<td width="25%" height="24"><%=rs1.getString("Language")%></td>
</tr>
<% } %>
</table>
<br>
<table border="0" width="100%">
<tr>
<td width="25%"></td>
<td width="50%" background="Web\Blue%20Line.bmp">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
</table>
<table border="0" width="100%" height="45">
<tr>
<td width="25%" height="14"></td>
<td width="50%" colspan="2" height="14">
<p align="center"><b><font size="3" color="#0099FF">P<span style="font-variant: small-caps">rinters</span></font></b></td>
<td width="25%" height="14"></td>
</tr>
<tr>
<td width="25%" height="19"></td>
<td width="25%" height="19"></td>
<td width="25%" height="19"></td>
<td width="25%" height="19"></td>
</tr>
</table>
<%
Statement stmt1 = conn.createStatement();
SQLstr = "Select Driver, Port, Type " +
"From amPrinter " +
"Where AssetTag = '" + AssetTagPrm + "' order by 1,2,3";

rs1 = stmt1.executeQuery(SQLstr);
%>
<table border=1 width="100%" cellpadding=0 cellspacing=0>
<tr>
<td width="25%" height="19"><b>Driver</b></td>
<td width="25%" height="19"><b>Port</b></td>
<td width="25%" height="19"><b>Path</b></td>
</tr>
<% while (rs1.next())
{ %>
<tr>
<td width="25%" height="19"><%= rs1.getString("Driver") %></td>
<td width="25%" height="19"><%= rs1.getString("Port") %></td>
<%
String PrinterType = rs1.getString("Type");
String PathName = "&nbsp;";
if (PrinterType.startsWith("\\")) {
PathName = PrinterType;
} %>
<td width="25%" height="19"><%= PathName %></td>
</tr>
<% } %>
</table>