首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > 在线商品销售

在线商品销售

  • 资源大小:2.38 MB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: java,tomcat,mysql,eclipse

资 源 简 介

public class DBConnection { private Connection connection; private String db_Name = "qian"; private String db_User = "root"; private String db_Password = "lubing"; public DBConnection(){ this.getConection(); } /* * 得到Connection对象。 */ public Connection getConection(){ try { // 加载数据库驱动 Class.forName("com.mysql.jdbc.Driver"); // 指定连接数据库的URL String url = "jdbc:mysql://localhost:3306/" + db_Name; // 通过DriverManager的getConnection()建立连接 connection = DriverManager.getConnection(url, db_User, db_Password); if (connection == null) { System.out.println("数据连接出错了!"); } } catch (Exception e) { e.printStackTrace(); } return connection ; } /* * 关闭数据集/语句/连接对象 */ public void close(Resul

文 件 列 表

OnlineShop
WebRoot
src
lib
.classpath
.mymetadata
.project
.settings
.jsdtscope
.myeclipse
.settings
VIP VIP
0.164002s