Hallo,
wie kann mich denn mein Ergebnis, was ich durch Select habe auf der Konsole ausgeben?
ich will im prinzip den Inhalt des Selects sehen.
Danke
Gruß Robin
wie kann mich denn mein Ergebnis, was ich durch Select habe auf der Konsole ausgeben?
Code:
public void DBeintrag_auslesen(String cmdV,String cmd0, String cmd1, String cmd2, String ip){
try {
// Load the JDBC driver
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
// Create a connection to the database
Connection connection = null;
String serverName = "localhost";
String mydatabase = "rtt_db";
String url = "jdbc:mysql://localhost/" + mydatabase; // the JDBC url
String username = "root";
String password = "";
connection = DriverManager.getConnection(url, username, password); // verbindungsaufbau
// select from DB
Statement stmt = connection.createStatement();
String sql_out = "SELECT * FROM renderauftrag ";
ResultSet rs = stmt.executeQuery(sql_out);
//int ok = stmt.executeQuery(sql_out);
System.out.println();
connection.close();
}
catch (ClassNotFoundException e) {System.out.println("Could not find the database driver");}
catch (SQLException e2){System.out.println("Could not read from the Database" +"\n" +e2);}
}
ich will im prinzip den Inhalt des Selects sehen.
Danke
Gruß Robin