import java.sql.*;
public class Tela1 {
public Tela1() {
String data = "jdbc:mysql:teste";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(
data, "", "");
Statement st = conn.createStatement();
ResultSet rec = st.executeQuery(
"SELECT * FROM marcio");
while(rec.next()) {
System.out.println(rec.getString(1)+ " "+ rec.getString(2));
}
st.close();
} catch (SQLException s) {
System.out.println("SQL Error: " + s.toString() + " "
+ s.getErrorCode() + " " + s.getSQLState());
} catch (Exception e) {
System.out.println("Error: " + e.toString()
+ e.getMessage());
}
}
public static void main(String[] args) {
Tela1 tela1 = new Tela1();
}
}
SQL Error: java.sql.SQLException: No suitable driver 0 08001
SQL Error: java.sql.SQLException: No suitable driver 0 08001
SQL Error: java.sql.SQLException: No suitable driver 0 08001
SQL Error: java.sql.SQLException: No suitable driver 0 08001