Tomcat5.5 配置hibernate/mysql数据源

MySql安装目录下找到  conf/context.xml

配置前代码:
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
 
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
</Context>


配置后代码:红色为配置数据源代码
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
 
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <!--配置数据源 代码如下-->
    <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="20" maxIdle="2" maxWait="5000" name="hibernate/mysql" password="" type="javax.sql.DataSource" url="jdbc:mysql://192.168.12.8:3306/mysql" username="mysql" />
</Context>

你可能感兴趣的:(tomcat,mysql,Hibernate,Web,jdbc)