Eclipse连接MySQL数据库(傻瓜篇)

您所在的位置:网站首页 eclipse如何使用JDBC连接mysql数据库 Eclipse连接MySQL数据库(傻瓜篇)

Eclipse连接MySQL数据库(傻瓜篇)

#Eclipse连接MySQL数据库(傻瓜篇)| 来源: 网络整理| 查看: 265

import java.sql.*;

publicclass Myjproject { publicstaticvoid main(String args[]) { try { Class.forName("com.mysql.jdbc.Driver"); //加载MYSQL JDBC驱动程序 //Class.forName("org.gjt.mm.mysql.Driver"); System.out.println("Success loading Mysql Driver!"); } catch (Exception e) { System.out.print("Error loading Mysql Driver!"); e.printStackTrace(); } try { Connection connect = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test","root","198876");

int num=100; PreparedStatement Statement=connect.prepareStatement("INSERT INTO user VALUES(?,?)"); for(int i=0;i



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3