配置数据源的问题。。
程序里:
public final static String DATASOURCE_NAME = "java:comp/env/jdbc/smgpDS";
protected Connection getConnection() throws NamingException, SQLException
{
_logger.debug("getting database connection");
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(DATASOURCE_NAME);
return ds.getConnection();
}
web.xml里的配置:
<resource-ref>
<description>DataSource of SMGP</description>
<res-ref-name>jdbc/smgpDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
那么,再往上面配置是怎么配置呢?是不是在server.xml里配置
<Resource name="jdbc/smgpDS" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/smgpDS">
....
....
....
具体怎么配置,哪位高手帮个忙?数据库是mysql的