建立基于JDBC的resin3.0.8的连接池

来源:互联网 发布:逐鹿seo军刀破解版 编辑:程序博客网 时间:2024/05/18 01:43
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
        先倒一番苦水,这个连接池搞了我整整3天.现在可以和数据库联接了,但是就是不能支持负载均衡,郁闷ing.还要继续奋战.先把建立连接池的过程写出来吧,避免大家多走弯路.resin的首页:http://www.caucho.com/index.xtp [速度奇慢]resin3.0.8下载地址:resin-3.0.8.tar.gz">http://www.caucho.com/download/resin-3.0.8.tar.gz (这里假设jdk已经安装/usr/local/j2sdk1.4.2_04 ,apache已经编译通过了位置是:/www)必须确保apache是支持DSO模式的,如果不知道的,可以使用命令进行确定:/www/bin/httpd -l | grep -i mod_so.c如果有就继续吧......编译resin:(文档上说建议使用gcc3.0以上,我本来是用2.95版本,编译的过程中出现warning,后来还是升级到了最新版3.4,编译mod_caucho.so出来的大小确实不一样,高版本要小很多。因此推荐使用高版本)tar zxf resin-3.0.8.tar.gzcd resin-3.0.8./configure --with-apxs=/www/bin/apxs && make && make install 编译完成后,如果是apache1.3版本的话mod_caucho.so会在/www/libexec目录,如果是2.0版本的话,mod_caucho.so会在/www/modules下面,这里我用的是1.3版本。然后就是设置环境变量:我的习惯是放到/etc/profile下面。JAVA_HOME=/usr/local/j2sdk1.4.2_04export JAVA_HOMECLASSPATH=/usr/local/j2sdk1.4.2_04/lib:$CLASSPATHexport CLASSPATH修改resin.conf,  <database>    <jndi-name>JDBC/oracle</jndi-name>    <driver>      <type>oracle.JDBC.pool.OracleConnectionPoolDataSource</type>      <url>JDBC:oracle:thin:@localhost:1521:appdb</url>      <user>test</user>      <password>test</password>    </driver>    <prepared-statement-cache-size>8</prepared-statement-cache-size>    <max-connections>30</max-connections>    <max-idle-time>30s</max-idle-time>  </database>最后执行/usr/local/resin-3.0.8/bin/httpd.sh确报错:conf/resin.conf:85: Can't load class `oracle.JDBC.pool.OracleConnectionPoolDataSource' in the current context.java.lang.ClassNotFoundException: oracle.JDBC.pool.OracleConnectionPoolDataSource这是本文要说的关键,大多数人都知道该怎么解决,但是这个问题真的缠绕了1天的时间,后来终于知道是oracle JDBC的驱动找不到。而这个驱动就是在包含在classes12.jar,可是我又找不到这个文件,find出来是classes12.zip,不管用。后来请教了一个高手后才知道该这样做:cd /oracle/product/8.1.7/JDBC/lib/unzip classes12.zipjar cf classes12.jar javax oraclerm -rf javax oracleunzip nls_charset12.zipjar cf nls_charset12.jar oraclerm -rf oracle最后在编辑CLASSPATH环境变量,而且必须要指到这个文件,不能光指这个lib目录export CLASSPATH=/oracle/product/8.1.7/JDBC/lib/classes12.jar:$CLASSPATH这样连接池就建立起来了!我还要继续配置resin.conf,心中还有很多疑问。先写到这里,希望能够帮助到一些和我一样被resin搞得抓狂的人!<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击