Druid Connection Oralce Database error problem ___ Database

Source: Internet
Author: User
Background description: According to project requirements, use Druid connection pool to connect MySQL database and Derby database; Problem Description: In Derby database environment error: Init dataSource error Encounter "<EOF>" at~~~. Analysis method: Initialization data times wrong, should be in the configuration file error, segment shielding configuration file, confirm the configuration item that produces the error is: Validationquery:select ' x '. The configuration item was commented and then an error: Testwhileidle is true,validataionquery not set. According to the literal meaning will testwhileidle modify to false no longer error, the project normal operation. However, there is a risk that the database will no longer be authenticated for connectivity. After reviewing the relevant data, it is found that different connection pools have different test statements (i.e. Validateionquery) when they connect to different databases. Combined with the error message (encounter "<EOF>") that is, the SQL statement syntax error occurs when the database is started and is associated with quotation marks. Confirm the Select ' X ' ERROR. According to the data, modify the test statement to the values 1 database to start running normally. Modified configuration: Dbconfig.properties
Url:jdbc:derby://localhost:1527/dbname
DriverClassName:org.apache.derby.jdbc.ClientDriver
Username:app
password:**********

Filters:stat

Maxactive:20
Initialsize:1
maxwait:60000
Minidle:10
Maxidle:15

timebetweenevictionrunsmillis:60000
minevictableidletimemillis:300000

Validationquery:select 1
Testwhileidle:true
Testonborrow:false
Testonreturn:false

Maxopenpreparedstatements:20
Removeabandoned:true
removeabandonedtimeout:1800
Logabandoned:true

Spring-*.xml <!--Ali Druid database connection pool-->
<bean id= "DataSource" class= "Com.alibaba.druid.pool.DruidDataSource" destroy-method= "Close" >
<!--database basic information Configuration-->
<property name= "url" value= "${url}"/>
<property name= "username" value= "${username}"/>
<property name= "Password" value= "${password}"/>
<property name= "Driverclassname" value= "${driverclassname}"/>
<property name= "Filters" value= "${filters}"/>
Maximum number of concurrent connections for the <!---->
<property name= "maxactive" value= "${maxactive}"/>
<!--initial number of connections-->
<property name= "InitialSize" value= "${initialsize}"/>
<!--Configure the time to get the connection wait timeout-->
<property name= "maxwait" value= "${maxwait}"/>
<!--minimum number of idle connections-->
<property name= "Minidle" value= "${minidle}"/>
<!--How long does the configuration interval take to detect and detect idle connections that need to be closed, in milliseconds-->
<property name= "Timebetweenevictionrunsmillis" value= "${timebetweenevictionrunsmillis}"/>
<!--Configure a connection to the minimum surviving time in the pool, in milliseconds-->
<property name= "Minevictableidletimemillis" value= "${minevictableidletimemillis}"/>
<property name= "Validationquery" value= "${validationquery}"/>
<property name= "Testwhileidle" value= "${testwhileidle}"/>
<property name= "Testonborrow" value= "${testonborrow}"/>
<property name= "Testonreturn" value= "${testonreturn}"/>
<property name= "maxopenpreparedstatements" value= "${maxopenpreparedstatements}"/>
<!--turn on removeabandoned function-->
<property name= "removeabandoned" value= "${removeabandoned}"/>
<!--1800 seconds, which is 30 minutes-->
<property name= "Removeabandonedtimeout" value= "${removeabandonedtimeout}"/>
<!--output error log when abanded connection is turned off-->
<property name= "logabandoned" value= "${logabandoned}"/>
</bean>

============================================================ Supplement: Other database and connection pool corresponding to the Validationquery, based on the following figure information to try to set up DBCP connection pool JDBC Connection Pool
Other connection pools:
Annex: This question refer to the URL solution https://my.oschina.net/xzfx/blog/478482 http://blog.csdn.net/zitong_ccnu/article/details/48629017 Http://blog.sina.com.cn/s/blog_72ef7bea0101hpj8.html http://blog.csdn.net/hj7jay/article/details/51686418
Reprint Address: https://blog.csdn.net/ronger4846/article/details/53487565

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.