A little supplement to the DBCP BasicDataSource connection in Struts 1.2

xiaoxiao2021-03-06  43

Some of the previous preparations have been described in the following article:

(Transfer) http://blog.9cbs.net/ggjjzhzz/archive/2004/09/13/103346.aspx

For the above article, I tested the DB2 database in Tomcat 5.0.28, an error occurred during deployment:

Cannot Create JDBC Driver of Class 'Com.ibm.db2.jdbc.app.db2driver' for Connect URL 'JDBC: DB2: FTPDATA'

After Google and study on the Internet, I finally solved this problem:

1, DataSource configuration in struts-config.xml

It should be noted that the Property "DriveClassName" in Struts 1.2 is "driverclass" in Struts 1.1, don't make a mistake.

I use DB2 is 7.2, which is JDBC 2.0 Driver, so run usejdbc2.bat in C: / Program Files / SQLLIB / Java12, and copy DB2JAVA.ZIP in this directory to your web- Under the lib directory of INF, the suffix is ​​JAR.

2, configure web.xml

Last Join in Web.xml:

IBM DB2 Connection JDBC / ftpdata com.ibm.db2.jdbc.app.db2driver < / res-type> Container

Note: ftpdata is a data source name that can be configured in the DB2 client configuration tool.

When I debug last night, according to some articles on the Internet, add this resouce-ref. But this morning, I didn't add this resource-ref. I can also connect DB2. I originally added this section of Resource-Ref in Tomcat's server.xml when eclipse released, but I am in Tomcat's Server.xml. Can't find it.

So this is also a master pointing point.

After starting Apache Tomcat 5.x in the J2EE View of Eclipse 3.0, the first release is normal, but when I modified the web.xml or other programs, it will also report similar words:

Cannot Create JDBC Driver of Class 'Com.ibm.db2.jdbc.app.db2driver' for Connect URL 'JDBC: DB2: FTPDATA'

This problem, I don't know if Tocmat's bug, if you have to stop Server every time you debug, release Project, start Server, really trouble.

转载请注明原文地址:https://www.9cbs.com/read-117305.html

New Post(0)