tomcat6.0数据库连接池配置实例(informix) 求大神支持下informix,如何配置tomcat数据库连接池,详细步骤TomcatInformix数据库连接池实例 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我做的尝试:1,在E:\mywork\apache-tomcat-6.0.32\lib下引入ifxjdbc.jar2,配置E:\mywork\apache-tomcat-6.0.32\conf下的context.xml,配置如下 <Resource name="jdbc/informix" type="javax.sql.DataSource" driverClassName="com.informix.jdbc.IfxDriver" maxIdle="2" maxWait="5000" username="cbsl" password="qqww" url="jdbc:informix-sqli://localhost:9021/hn4300car3gdb:informixserver=hn_4300_cb_ids;NEWLOCALE=zh_CN,zh_CN;NEWCODESET=gb18030,8859-1,819;IFX_USE_STRENC=true" maxActive="4"/> 3,在web.xml中配置如下<resource-ref> <description>Informix DB Connection Pool</description> <res-ref-name>jdbc/informix</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> 4,test测试数据 public static void main(String[] args) { DataSource ds = null; try{ Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); ds = (DataSource) envCtx.lookup("jdbc/informix"); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); String strSql = " select psncode,psnname from bd_psndoc"; ResultSet rs = stmt.executeQuery(strSql); ArrayList<Monopolyer> ms= new ArrayList<Monopolyer>(); while(rs.next()){ Monopolyer m=new Monopolyer(); m.setPsncode(rs.getString(1)); m.setPsnname(rs.getString(2)); System.out.println(m.getPsncode()); ms.add(m); } } catch(Exception ex){ ex.printStackTrace(); } }5,报错----javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial java 怎么自动生成txt文件 关于一个网站设计的问题 请教,麻烦各位前辈帮忙看看^^ 单击一个超链接后如何弹出一个网页小窗口? JSP request.getparameter() 不是说hashcode()是唯一标识一个对象么但是如果 a.equals(b)==true=>a.hashcode()==b.hashcode() 必填项校验 与IE缓存 java.lang.NullPointerException 采鸟求助大哥们。。! 郁闷当然。。 急急急急!!!!!!!!!!!!!!!1 JSP中怎么让光标一直停在 登陆按钮上 如何检查java代码的安全性。 求救啊
2,配置E:\mywork\apache-tomcat-6.0.32\conf下的context.xml,配置如下
<Resource
name="jdbc/informix"
type="javax.sql.DataSource"
driverClassName="com.informix.jdbc.IfxDriver"
maxIdle="2"
maxWait="5000"
username="cbsl"
password="qqww"
url="jdbc:informix-sqli://localhost:9021/hn4300car3gdb:informixserver=hn_4300_cb_ids;NEWLOCALE=zh_CN,zh_CN;NEWCODESET=gb18030,8859-1,819;IFX_USE_STRENC=true"
maxActive="4"/>
3,在web.xml中配置如下<resource-ref>
<description>Informix DB Connection Pool</description>
<res-ref-name>jdbc/informix</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> 4,test测试数据
public static void main(String[] args) {
DataSource ds = null;
try{
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds = (DataSource) envCtx.lookup("jdbc/informix");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
String strSql = " select psncode,psnname from bd_psndoc";
ResultSet rs = stmt.executeQuery(strSql);
ArrayList<Monopolyer> ms= new ArrayList<Monopolyer>();
while(rs.next()){
Monopolyer m=new Monopolyer();
m.setPsncode(rs.getString(1));
m.setPsnname(rs.getString(2));
System.out.println(m.getPsncode());
ms.add(m);
}
}
catch(Exception ex){
ex.printStackTrace();
}
}
5,报错----javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial