引用 websphere datasource <resource-ref> <description>Datasource</description> <res-ref-name>jdbc/oracle</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.PROVIDER_URL, "iiop://localhost:2809");
Context ctx = new InitialContext(properties);
DataSource ds = (DataSource) ctx.lookup("jdbc/Oracle");
Connection conn = ds.getConnection();
out.println(conn + "<br>");
conn.setAutoCommit(false);
String query = "select sysdate from dual";
ResultSet rs = null;
PreparedStatement ps = conn.prepareStatement(query);
rs = ps.executeQuery();
while(rs.next()){
out.println((java.util.Date)rs.getDate(1) + "<br>" );
}
conn.commit();
rs.close();
ps.close();
conn.close();
JVM :应用服务器 -->server-->服务基础架构-->进程定义-->JVM 256 512
4555

被折叠的 条评论
为什么被折叠?



