JDBC连接Oracle数据库问题

hhb2009sunny 2013-08-28 03:07:16
我在使用JDBC连接数据库,调试时出现如上所示
public ArrayList<Hashtable<String, String>> getList(String paramString) {
ArrayList<Hashtable<String, String>> localArrayList = new ArrayList<Hashtable<String, String>>();
try {
this.conn = getConnection();
this.stmt = this.conn.createStatement();

ResultSet localResultSet = this.stmt.executeQuery(paramString);
ResultSetMetaData localResultSetMetaData = localResultSet
.getMetaData();
int i = localResultSetMetaData.getColumnCount();
while (localResultSet.next()) {
Hashtable<String, String> localHashtable = new Hashtable<String, String>();
for (int j = 1; j <= i; ++j) {
String str1 = localResultSetMetaData.getColumnName(j);
String str2 = localResultSet.getString(j);
if (str2 == null)
str2 = "";
localHashtable.put(str1, str2);
}
localArrayList.add(localHashtable);
}
localResultSet.close();
this.stmt.close();
this.conn.close();
} catch (SQLException localSQLException) {
try {
this.stmt.close();
this.conn.close();
} catch (Exception localException) {
}
}
return localArrayList;
}
,就是在this.stmt = this.conn.createStatement();这句话处出错,调用数据库连接的页面代码如下:
<%@page language="java" contentType="text/html;charset=gb2312"%>
<jsp:useBean id="db" class="xw.ConnDb" />
<jsp:useBean id="str" class="xw.StrManager" />
<jsp:useBean id="c_check" class="xw.ErrorCheck" />
<html>
<head>
<title>Cookie版 购物车</title>
<style type="text/css">
a {
font-size: 12px;
text-decoration: none;
}
table {font-size:12px;}
#shop{border:5px solid #ccc;}
@IMPORT url("Jash.css");
</style>

</head>
<body>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>

<%

java.util.ArrayList<java.util.Hashtable<String,String>> rs = new java.util.ArrayList<java.util.Hashtable<String,String>>();
rs = db.getList("select PRID,NAME,CONTENT,PIC,XID,DID,BPRICE,SPRICE from a2009_shuhua_product");

if (rs != null) {
java.util.Hashtable<String,String> hash = new java.util.Hashtable<String,String>();
for (int i = 0; i < rs.size(); i++) {
hash = rs.get(i);
String PRID = str.notEmpty(hash.get("PRID"));
String SPRICE = str.notEmpty(hash.get("SPRICE"));
String BPRICE = str.notEmpty(hash.get("BPRICE"));
String NAME = str.notEmpty(hash.get("NAME"));
String PIC = str.notEmpty(hash.get("PIC"));
%>
<%
if (i == 0) {
%>
<TR>
<%
}
%>
<%
if (i != 0 && i % 4 == 0) {
%>
</TR>
<TR>
<%
}
%>
<TD height=80>
<TABLE cellSpacing=1 cellPadding=2 width=155 align=center border=0>
<TBODY>
<TR>
<TD align=middle>
<A href="iteminfo.jsp?prid=<%=PRID%>" target=_blank><IMG
height=120 src="<%=PIC%>" width=120 border=0 id="shop">
</A>
</TD>
</TR>
<TR>
<TD>
<IMG style="CURSOR: hand"
onclick="centerNewWin('/iteminfo.jsp?prid=<%=PRID%>', '4444', 900, 650)"
src="images/icon_mag.gif" align=absMiddle>
<A href="iteminfo.jsp?prid=<%=PRID%>" target=_blank><%=NAME%></A>
<BR>
<SPAN class=red><BR>
<IMG src="images/icon_won.gif" align=absMiddle vspace=2> <%=SPRICE%>
<BR>
<IMG src="images/icon_point_s.gif" align=absMiddle vspace=2> <%=BPRICE%> <!--<img src="/images_china/icon_nointerest_s.gif" vspace="2" align="absmiddle"> 0 -->
</SPAN>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
<TD bgColor=#e3e3e3>
<IMG height=1 src="images/blank.gif" width=1>
</TD>
<%
if (i == 0 && i % 4 != 0) {
%>
<TD width=35>
    
</TD>
<%
}
%>
<%
hash = null;
}
hash = null;
}
rs = null;
%>

<TR>
<TD colSpan=8 height=10>
 
</TD>
</TR>
<TR>
<TD class=linetable width="100%" colSpan=8 height=1></TD>
</TR>
<TR>
<TD colSpan=8 height=10>
 
</TD>
</TR>


</TBODY>
</TABLE>
</body>
</html>
,大家有没有遇见过这种情况?大侠们,我是刚刚学习Java Web开发,希望大家可以帮我一下。
...全文
145 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
无聊找乐 2013-08-29
  • 打赏
  • 举报
回复
跟的代码没有源码~~~
licip 2013-08-29
  • 打赏
  • 举报
回复
你用的是jar文件,然后,你调试想进它的源码中去,就会出现这个窗口的内容。
wanpeizhi 2013-08-29
  • 打赏
  • 举报
回复
设置断点调试,从你说的来看,很有可能this.con为空,也就是没有获取到连接
我的波塞冬 2013-08-29
  • 打赏
  • 举报
回复
错误信息是啥?
wenjie4892543 2013-08-28
  • 打赏
  • 举报
回复
驱动 jar包
wasdasdfqwer 2013-08-28
  • 打赏
  • 举报
回复
引用 2 楼 fudongrifdr 的回复:
你这张图哪里是什么调试出错情况。。。
这个情况
末日哥 2013-08-28
  • 打赏
  • 举报
回复
你这张图哪里是什么调试出错情况。。。
hhb2009sunny 2013-08-28
  • 打赏
  • 举报
回复
调试出错的情况:

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧