Myeclipse used in the allocation of mysql and struts in the datasource sqlserver

  Myeclipse used in the allocation of mysql and struts in the datasource sqlserver 

  Today, with myeclipse    In struts    Configuration mysql    The data source,    Tips always find driver,    On the Internet for help,    Finally found a solution. 
  Directly in the struts-config.xml    Right in the data-sources    And New    .    The default type    Is: org.apache.struts.util.GenericDataSource, struts    Comes with a database connection pool.    And then to enter all kinds of property    The value    .    Testing, ease of use. 
  If the type    Choices: org.apache.commons.dbcp.BasicDataSource    The DBCP    The database connection pool.    Then type the correct value    .    Test, suggesting that all kinds of anomalies can not find Driver    . 
  Show DBCP    The documents, found MYECLIPSE    Generation of XML configuration    Elements of a problem. 
DBCP   Need is driverClassName    Username and    These two properties    . 
  The Myeclipse    Is automatically generated driverClass    And user    These two properties    . 
  After the discovery over to DBCP    The database connection pool or used,    This should be regarded as MYECLIPSE    Development struts    A BUG    Bar, the database connection pool configuration in accordance with the struts    The default GenericDataSource    The past. 
  Summary: 
myeclipse   Automatically generated strust-config.xml    A few points to note: 
1.driverClassName   Not driverclass; 
2.username   Is not user 
3.   Do not set loginTimeout. 
action   Call: DataSource ds = getDataSource (request, "datasource"); 


  MSSQLServer2000    Data source configuration 

<data-sources>
  <data-source key="datasource" 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=zzb" /> 
  <set-property property="username" value="sa" /> 
  <set-property property="password" value="" /> 
  <set-property property="maxActive" value="10" /> 
  <set-property property="maxWait" value="5000" /> 
  <set-property property="defaultAutoCommit" value="false" /> 
  <set-property property="defaultReadOnly" value="false" /> 
  </ data-source> 
  </ data-sources> 

  MySQL    Data source configuration 
  <data-sources> 
  <data-source key="datasource" type="org.apache.commons.dbcp.BasicDataSource"> 
  <set-property property="password" value="1234" /> 
  <set-property property="minCount" value="1" /> 
  <set-property property="maxCount" value="10" /> 
  <set-property property="username" value="root" /> 
  <set-property property="driverClassName" value="org.gjt.mm.mysql.Driver" /> 
  <set-property property="description" value="for struts attack aolution" /> 
  <set-property property="url" value="jdbc:mysql://localhost:3306/attack" /> 
  <set-property property="readOnly" value="false" /> 
  <set-property property="autoCommit" value="true" /> 
  </ data-source> 
  </ data-sources> 

  Calling the time in Action    Inside getDataSource (request, "    datasource ");    This is above that key datasource    Value, corresponding to two persons, OK!!! 
  Note commons-collections.jar, commons-pool.jar, commons-dbcp.jar    There are database-driven copy must pay attention to the tomcat / common / lib    Inside, commons-collections.jar, commons-pool.jar, commons-dbcp.jar    By Tomcat    Its own,    In the directory of the above,    In fact, as long as the database can be driven into the Qujiu. Commons-collections.jar, commons-pool.jar, commons-dbcp.jar    If not, then to apache    The site can be a v 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • DZone
  • Netvouz
  • NewsVine
  • Technorati

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Tags:

Releated Articles

Leave a Reply

You must be logged in to post a comment.