tomcat+hibernate配置jndi数据源的问题
context.xml
<Resource name="jdbc/hibernate" auth="Container" type="javax.sql.DataSource" maxActive="20" maxIdel="10" maxWait="1000" username="root" password="root" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hibernate_jndi"> </Resource>
<property name="connection.datasource">java:comp/env/jdbc/hibernate</property>
Configuration cfg = new Configuration();cfg.configure();SessionFactory factory = cfg.buildSessionFactory();Session session = factory.openSession();