1. Configuration files
<BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> <!--Basic Property URL, user, password - < Propertyname= "url"value= "${jdbc_url}" /> < Propertyname= "username"value= "${jdbc_user}" /> < Propertyname= "Password"value= "${jdbc_password}" /> <!--Configure initialization size, minimum, maximum - < Propertyname= "InitialSize"value= "1" /> < Propertyname= "Minidle"value= "1" /> < Propertyname= "Maxactive"value= " the" /> <!--Configure the time to get the connection wait timeout - < Propertyname= "Maxwait"value= "60000" /> <!--How often the configuration interval is detected to detect idle connections that need to be closed, in milliseconds - < Propertyname= "Timebetweenevictionrunsmillis"value= "60000" /> <!--configures the minimum lifetime of a connection in a pool, in milliseconds - < Propertyname= "Minevictableidletimemillis"value= "300000" /> < Propertyname= "Validationquery"value= "Select ' X '" /> < Propertyname= "Testwhileidle"value= "true" /> < Propertyname= "Testonborrow"value= "false" /> < Propertyname= "Testonreturn"value= "false" /> <!--open Pscache, and specify the size of Pscache on each connection - < Propertyname= "Poolpreparedstatements"value= "true" /> < Propertyname= "Maxpoolpreparedstatementperconnectionsize"value= " the" /> <!--Configure monitoring Statistics interception filters, remove post-monitoring interface SQL cannot be counted - < Propertyname= "Filters"value= "Stat" /> </Bean> <BeanID= "DataSource"class= "Com.alibaba.druid.pool.DruidDataSource"Init-method= "Init"Destroy-method= "Close"> <!--Basic Property URL, user, password - < Propertyname= "url"value= "${jdbc_url}" /> < Propertyname= "username"value= "${jdbc_user}" /> < Propertyname= "Password"value= "${jdbc_password}" /> <!--Configure initialization size, minimum, maximum - < Propertyname= "InitialSize"value= "1" /> < Propertyname= "Minidle"value= "1" /> < Propertyname= "Maxactive"value= " the" /> <!--Configure the time to get the connection wait timeout - < Propertyname= "Maxwait"value= "60000" /> <!--How often the configuration interval is detected to detect idle connections that need to be closed, in milliseconds - < Propertyname= "Timebetweenevictionrunsmillis"value= "60000" /> <!--configures the minimum lifetime of a connection in a pool, in milliseconds - < Propertyname= "Minevictableidletimemillis"value= "300000" /> < Propertyname= "Validationquery"value= "Select ' X '" /> < Propertyname= "Testwhileidle"value= "true" /> < Propertyname= "Testonborrow"value= "false" /> < Propertyname= "Testonreturn"value= "false" /> <!--open Pscache, and specify the size of Pscache on each connection - < Propertyname= "Poolpreparedstatements"value= "true" /> < Propertyname= "Maxpoolpreparedstatementperconnectionsize"value= " the" /> <!--configuration filters, it's not understandable why not list? - <!--Stat Monitoring Statistics interception - <!--Encoding Monitoring statistics interception - < Propertyname= "Filters"value= "Stat,encoding" /> < Propertyname= "ConnectionProperties"> <!--The link parameters are configured with "Clientencoding" and "serverencoding", respectively specifying the database client and the server-side character encoding Encoding filter from both parameters Get the encoding - <value>clientencoding=gbk;serverencoding=iso-8859-1;</value> </ Property></Bean>
2. Disadvantages
The current application is deployed on WebLogic and cannot be used to define JNDI using the data source method.
Druid Configuring Database Encoding