tomcat服务器配置ms sql数据库的数据源

    技术2022-05-11  107

    web.xml中的内容: ===================================================================================== <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4"     xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">        <resource-ref>       <description>       JNDI DataSource for test       </description>       <res-ref-name>jdbc/sqlserver</res-ref-name>       <res-type>javax.sql.DataSource</res-type>       <res-auth>Container</res-auth>       <res-sharing-scope>Shareable</res-sharing-scope>    </resource-ref> </web-app> ========================================================================================= server.xml中的增加的内容: =========================================================================================       <Host name="localhost" appBase="webapps"        unpackWARs="true" autoDeploy="true"        xmlValidation="false" xmlNamespaceAware="false">              <Context path="/jsp1" docBase="jsp1"              debug="5" reloadable="true" crossContext="true">           <Resource name="jdbc/sqlserver" auth="Container" type="javax.sql.DataSource"                maxActive="100" maxIdle="30" maxWait="10000"                username="sa" password="sa"                 driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"                url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test"/>    </Context>

    最新回复(0)