我在查询一条数据,涉及到一个条件title='北京';以前使用c3p0的配置就能查询出来数据,现在仅仅修改了一下连接池为proxool,相关配置没有变化,就是查询不出来数据了。如果是title='beijing',是能查询出来的。数据库是mysql 编码方式utf-8通过hibernate的getHibernateTemplate()执行查询cc3p0的配置
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">gb2312</prop>
<prop key="hibernate.connection.characterSetResults">gb2312</prop>proxool同样的配置
请高手解惑
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">gb2312</prop>
<prop key="hibernate.connection.characterSetResults">gb2312</prop>proxool同样的配置
请高手解惑
<!-- the proxool configuration can be embedded within your own application's.Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DBPool</alias>
<driver-url>jdbc:mysql://localhost:3306/vin?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=UTF-8</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root"/>
<property name="password" value=""/>
</driver-properties><!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁 -->
<house-keeping-sleep-time>90000</house-keeping-sleep-time><!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受 -->
<maximum-new-connections>100</maximum-new-connections><!-- 最少保持的空闲连接数 -->
<prototype-count>3</prototype-count><!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定 -->
<maximum-connection-count>50</maximum-connection-count><!-- 最小连接数 -->
<minimum-connection-count>3</minimum-connection-count><!-- 在分配连接前后是否进行有效性测试,这个是解决本问题的关键 -->
<test-before-use>true</test-before-use>
<test-after-use>true</test-after-use><!-- 用于测试的SQL语句 -->
<house-keeping-test-sql>SELECT CURRENT_USER</house-keeping-test-sql></proxool>
</something-else-entirely>
<!-- the proxool configuration can be embedded within your own application's.Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DBPool</alias>
<driver-url>jdbc:mysql://localhost:3306/vin?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=UTF-8</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root"/>
<property name="password" value=""/>
</driver-properties><!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁 -->
<house-keeping-sleep-time>90000</house-keeping-sleep-time><!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受 -->
<maximum-new-connections>100</maximum-new-connections><!-- 最少保持的空闲连接数 -->
<prototype-count>3</prototype-count><!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定 -->
<maximum-connection-count>50</maximum-connection-count><!-- 最小连接数 -->
<minimum-connection-count>3</minimum-connection-count><!-- 在分配连接前后是否进行有效性测试,这个是解决本问题的关键 -->
<test-before-use>true</test-before-use>
<test-after-use>true</test-after-use><!-- 用于测试的SQL语句 -->
<house-keeping-test-sql>SELECT CURRENT_USER</house-keeping-test-sql></proxool>
</something-else-entirely>
SELECT o FROM NoteBook AS o WHERE o.notebookId = 5 AND o.title = '北京'c3p0里也是这个查询语句,就是能得到记录是1 而proxool里就是0。