熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

tomcat的sql server數據源的配置

2022-06-13   來源: Java開源技術 

  Apache Tomcat/
  
  把jdbc包拷貝到%TOMCAT_HOME%/common/lib下面並將jdbc包加入到系統變量classpath
  
  serverxml的配置
  
  connector的配置屬性添加 URIEncoding=UTF 屬性
  
  context的配置實例如下
  
  <Context docBase=E:\eclipse\workspace\tomcat\deployables\tomcat path= reloadable=true source=comibmwtpwebserver:tomcat>
  <Logger className=orgapachecatalinaloggerFileLogger
  prefix=tomcat_log suffix=txt
  timestamp=true/>
  
  <Resource name=jdbc/SqlServer
  auth=Container
  type=javaxsqlDataSource
  reloadable=true/>
  
  <ResourceParams name=jdbc/SqlServer>
  <parameter>
  <name>factory</name>
  <value>monsdbcpBasicDataSourceFactory</value>
  </parameter>
  
  <parameter>
  <name>maxActive</name>
  <value></value>
  </parameter>
  
  <parameter>
  <name>maxIdle</name>
  <value></value>
  </parameter>
  
  <parameter>
  <name>maxWait</name>
  <value></value>
  </parameter>
  
  <parameter>
  <name>username</name>
  <value>dev</value>
  </parameter>
  <parameter>
  <name>password</name>
  <value>dev</value>
  </parameter>
  
  <parameter>
  <name>driverClassName</name>
  <value>commicrosoftjdbcsqlserverSQLServerDriver</value>
  </parameter>
  
  <parameter>
  <name>url</name>
  <value>jdbc:microsoft:sqlserver://:;SelectMethod=cursor</value>
  </parameter>
  </ResourceParams>
  </Context>
  
  Apache Tomcat/
  
  serverxml的配置
  
  connector的配置屬性添加 URIEncoding=UTF 屬性
  
  context的配置實例如下
  
  <Context docBase=E:\eclipse\workspace\khrscm_tomcat\deployables\tomcat path= reloadable=true source=comibmwtpwebserver:tomcat>
  <Resource name=jdbc/SqlServer auth=Container type=javaxsqlDataSource
  maxActive= maxIdle= maxWait=
  username=dev password=dev driverClassName=commicrosoftjdbcsqlserverSQLServerDriver
  url=jdbc:microsoft:sqlserver://:;SelectMethod=cursor/>
  </Context>
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28548.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.