package com.xushiwei;import java.beans.Statement;import java.sql.*;public class jdbc { private static final String URL="jdbc:mysql://127.0.0.1:3306/xushiwei"; private static final String USER="root"; private static final String PASSWORD="123456"; public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); Connection conn=DriverManager.getConnection(URL,USER,PASSWORD); java.sql.Statement xushi=conn.createStatement(); ResultSet x=xushi.executeQuery("select name from miao "); while(x.next()){ System.out.println(x.getString("name")); } } }
添加回答
举报
0/150
提交
取消