`
雨中伞
  • 浏览: 43917 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

websphere JVM trace.log jndi datasource

阅读更多
引用 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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics