Archive for Database

Spring + DBCP

Adding a connection pool to a Spring app is simply a matter of specifying the relevant entries in the Spring servlet configuration file. The XML snippet below shows an example of how a database connection pool can easily be configured.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  <property name="driverClassName">
  <property name="url">
  <property name="username">
  <property name="password">
  <property name="initialSize">
  <property name="maxActive">
  <property name="maxIdle">

There are more options that can be used to configure the DBCP connection pool,
eg whether to test connections when getting from the pool or the time to wait
before getting a connection. The complete list of options is given

Comments (16)

mySQL Backup in DOS cmd

  • goto msql install path/..server../bin
  • backup: mysqldump –user=myusername –password=mypassword –opt –databases db01 > c:/data/db01.sql
  • restore: mysql –user=myusername –mypassword db01 < c:/data/db01.sql

Leave a Comment