1.ÔÚTomcateÖĞ/conf/context.xmlÎļşÖĞÅäÖÃÔÚÕâ¸ö½ÚµãÖĞÌí¼ÓContext//jdbc/newsÊÇÊı¾İÔ´µÄÃû³ÆResourcename=jdbc/newsauth=Containertype=javax.sql.DataSourcemaxActive=100maxIdle=30maxWait=10000username=sapassword=123driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriverurl=jdbc:sqlserver://localhost:1433;DatabaseName=NewsManagerSystem//Context2.ÅäÖÃ/webRoot/WEB-INF/web.xmlÎļşweb-appresource-refdescriptionnewsDataSource/descriptionres-ref-namejdbc/news/res-ref-nameres-typejavax.sql.DataSource/res-typeres-authContainer/res-auth/resource-ref/web-app3.°ÑÇı¶¯°ü·Åµ½lib°üÄÚ4.ÔÚbasedaoÖбàĞ´´úÂëContextctx=newInitialContext();//jdbc/newsÊı¾İÔ´µÄÃû³ÆDataSourceds=(DataSource)ctx.lookup(java:comp/env/jdbc/news);Connectionconn=ds.getConnection();