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
2024年4月27日
LoveyRay LV1
2024年2月26日
jiayongchao258 LV9
2024年1月8日
zdmxjxj LV11
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日

最近浏览
