Hibernate framework and DBCP or other connection pool

xiaoxiao2021-03-13  187

The following three connections are in connection with MySQL.

org.gjt.mm.mysql.Driver jdbc: mysql: // localhost:? 3306 / struts useUnicode = true & characterEncoding = GBK

root

8888

The above configuration, in C3P0 and DBCP, it is necessary because Hibernate generates Connections according to the above configuration, then handed over to C3P0 or DBCP management. However, proxool can not, although in convincing documents, Proxol can also be Hibernate is combined, but I am equipped with an error in accordance with the official documentation, and I have asked in Sun and Hibernat some of the official website, no one reply. Later, I can only let the proxool themselves generate connections, which will be explained below.

1 C3P0

Just join in hibernate.cfg.xml

5

30

1800

50

There is also the addition of C3P0-0.8.4.5.jar in Classespath.

2 dbcp

Add to Hibernate.cfg.xml

100

60000

10

100

60000

pool1

ProxoolConf.xml

ANYTHING OUTSIDE The "Proxool" tag is ignored. ->

pool1

JDBC: MySQL: // Localhost: 3306 / Struts? Useunicode = true & characterencoding = GBK

Org.gjt.mm.mysql.driver

90000

20

5

100

10

And add proxool-0.8.3.jar in Classespath

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

New Post(0)