Eclipse-jee-europa-fall2-win32.zip 下用JFS和Tomcat防问SQLServer数据库的以下配置:
//server.xml 必须放在工程内
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="sa" password="" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs"/>
//web.xml 放在根目录下就OK
<resource-ref>
<description>postgreSQL Datasource example</description>
<res-ref-name>jdbc/mydb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
//内访问 写在DAO数据接口内中
InitialContext context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:/comp/env/jdbc/mydb");
Connection con = ds.getConnection();
前提是先导入:JSF的三个jar包.2个JSF包,1个JSTL包.以及SQL的驱动包.