JDBC链接出错

猿树洞 猿树洞 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
package cn.sql;

import java.sql.*;

public class DataBase
{
static final String JDBC_DRIVER ="com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql//localhost:3306/qb";

static final String USER = "root";
static final String PASS = "";

public static void main(String[] args) throws SQLException
{
Connection con = null;
Statement sta = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
con = DriverManager.getConnection(DB_URL,USER, PASS);
sta = con.createStatement();
String sql;
sql = "stlect id,top, from qc";
ResultSet rs = sta.executeQuery(sql);
System.out.println("输出ssss"+rs);
rs.close();
sta.close();
con.close();

// TODO: handle exception
}
}
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
猿树洞
Java 51,407 成员 86,126 内容