????2.oracle??context.xml???????????????????????

????3.mysql??context.xml?????

<Resource name="????"
auth="Container"
type="javax.sql.DataSource" //???????
driverClassName="org.gjt.mm.mysql.Driver"
url="jdbc:mysql://localhost/???????"
username="?????"
password="????"
maxActive="100" //????????
maxIdle="30" //????????0???????
maxWait="10000"/> //????????????????

????---------------------???????????----------------------------------------

??????????????????????????????sql2005????

????context.xml?????

<?xml version="1.0" encoding="GBK"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!--2000??driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"-->
<!--2000??url="jdbc:microsoft:sqlserver://192.168.0.15:1433;DatabaseName=XR-2000" -->
<!--2005??driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"-->
<!--2005??url="jdbc:sqlserver://localhost:1433;DatabaseName=XR-2000" -->
<Resource
name="jdbc/sql"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;DatabaseName=XR-2000"
username="sa"
password="123456"
maxActive="200"
maxIdle="50"
maxWait="-1"/>
</Context>

?????????

Context ctx = null;
try {
ctx = new InitialContext();
} catch (NamingException e1) {
}

DataSource ds = null;
try {
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/sql");
} catch (NamingException e2) {
}

Connection conn = null;
try {
conn = ds.getConnection();
} catch (SQLException e3) {
}

Statement stmt = null;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE??
ResultSet.CONCUR_UPDATABLE);//?????????????????????rs.last()??????
} catch (SQLException e) {
}