websphere4连接DB2数据库的问题,急啊

frieblade 2004-10-13 10:01:55
程序中采用JDNI调用数据库
我连接数据库部分是这么写的
public class DBManage {

private static PropertyResourceBundle sqlBundle;
private static PropertyResourceBundle configBundle;

private DataSource ds = null;
private Connection cn = null;
private PreparedStatement ps = null;
private ResultSet rs = null;
private String strDataSource = null;
private String strDataBase = null;
private String NAMESPACE = "<nameSpace>";
private String TABLENAME = "<tableName>";
//private PrintWriter log;

static {
sqlBundle =
(PropertyResourceBundle) PropertyResourceBundle.getBundle(
"cn.com.net99.db.sql");
configBundle =
(PropertyResourceBundle) PropertyResourceBundle.getBundle(
"cn.com.net99.db.config");
}

/**
* 构造函数。在该构造函数中获取连接数据库需要的DataSource。
* @throws Exception
*/
public DBManage() throws Exception {
Context ctx = null;
try {
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
strDataSource = configBundle.getString("DataSource");
// strDataBase = configBundle.getString("DataBase");
//String strLogFile = configBundle.getString("logfile");
//log = new PrintWriter(new FileWriter(strLogFile, true), true);
ctx = new InitialContext(parms);
//ctx = new InitialContext();
ds = (DataSource) ctx.lookup(strDataSource);
}
catch (Exception e) {
e.printStackTrace();
System.out.println("数据库操作错误");
}
finally {
if (ctx != null) {
ctx.close();
}
}
}

config.properties是这么写的

DataSource=java:comp/env/jdbc/CHINA
DataBase=CHINA


web.xml是这么写的

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app id="WebApp_ID">
<display-name>IPDPoD</display-name>
<description>IPDPoD</description>
<welcome-file-list id="WelcomeFileList_1">
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<env-entry>
<env-entry-name>param/DBNameSpace</env-entry-name>
<env-entry-value>CHINA</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
</web-app>


但是在websphere4抱错
[04.10.13 09:40:45:677 CST] 1bbc8052 SystemOut U ???????
[04.10.13 09:40:45:726 CST] 1bbc8052 WebGroup X Servlet Error: java.lang.String: method replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; not found: java.lang.Exception: java.lang.String: method replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; not found
at admin.index_jsp_0._jspService(index_jsp_0.java:210)


请问这个是什么错误啊,我应该怎么改啊,急!!!
(websphere4没法换)
...全文
63 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
majinbo2000 2004-10-13
  • 打赏
  • 举报
回复
我已经注册了,怎么找不到发新主题的地方呀
frieblade 2004-10-13
  • 打赏
  • 举报
回复
有的朋友说是websphere4里带的JDK没有java.long.String这个包可是服务器公司不让换也不让动JDK
请问各位可能是哪里错了
我应该怎么改啊

2,100

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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