import java.sql.*;
public class MySqlConnect{
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Polaroid?user=root&password=");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from cases");
while(rs.next()) {
System.out.println( rs.getString("id"));
}
st.close();
rs.close();
con.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
public class MySqlConnect{
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Polaroid?user=root&password=");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from cases");
while(rs.next()) {
System.out.println( rs.getString("id"));
}
st.close();
rs.close();
con.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
No comments:
Post a Comment