DataSource
请问一下,如何用java程序编写一个DataSource连接的数据库呀?
------解决方案-------------------- <data-sources>
<data-source type= "org.apache.commons.dbcp.BasicDataSource ">
<set-property property= "driverClassName "
value= "com.microsoft.jdbc.sqlserver.SQLServerDriver " />
<set-property property= "url "
value= "jdbc:microsoft:sqlserver://localhost:1433;databaseName=baidu " />
<set-property property= "username " value= "sa " />
<set-property property= "password " value= " " />
<set-property property= "maxActive " value= "20 " />
<set-property property= "maxWait " value= "5000 " />
<set-property property= "defaultAutoCommit " value= "true " />
<set-property property= "defaultReadOnly " value= "false " />
<set-property property= "validationQuery " value= "SELECT 1 " />
<set-property property= "removeAbandoned " value= "true " />
<set-property property= "removeAbandonedTimeout " value= "120 " />
<set-property property= "encoding " value= "false " />
</data-source>
</data-sources>