package com.home.db; import java.sql.Connection; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; public class Conntion { private Connection conn ; public Conntion() throws Exception{ String DSName="java:comp/env/jdbc/mypro"; Context ctx=new InitialContext(); DataSource ds=(DataSource)ctx.lookup(DSName); this.conn = ds.getConnection(); } public Connection getConnection() { return this.conn ; } public void close(){ if(this.conn != null){ try{ this.conn.close() ; }catch(Exception e){ e.printStackTrace(); } } } }
最近下载更多
兮希熙西 LV1
4月27日
LoveyRay LV1
2月26日
jiayongchao258 LV9
1月8日
zdmxjxj LV9
2023年4月8日
flowerdance LV1
2023年4月4日
北方菜 LV11
2023年2月10日
hgjhbvjhgbjh LV1
2023年1月9日
lvllvl LV4
2023年1月8日
微信网友_6268131861106688 LV5
2022年12月19日
2511952410 LV9
2022年8月14日
最近浏览更多
18699449369 LV2
前天
兮希熙西 LV1
4月27日
xdyyds
3月27日
暂无贡献等级
LoveyRay LV1
2月26日
1362263483
2月19日
暂无贡献等级
rongtao LV1
1月9日
jiayongchao258 LV9
1月8日
asddwh LV12
2023年12月26日
ddzfgh LV1
2023年12月25日
99123123
2023年12月25日
暂无贡献等级