package com.database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class JustExcuteSimpleToTest { public static String DataBaseURL = "jdbc:mysql://localhost:3306/gaoxiangyu"; public static String username = "root"; public static String password = "root"; public static String DriverPath = "com.jdbc.mysql.Driver"; public static void main(String[] args) throws SQLException { // TODO Auto-generated method stub try{ Connection conn = null; conn = DriverManager.getConnection(DataBaseURL, username, password);//加载驱动,并建立连接 Statement st = conn.createStatement();// System.out.println(st.execute("select * from gaoxiangyu.userinfo")); st.close(); conn.close(); }catch(Exception e){ e.printStackTrace(); } } }