Hi,
I'm just trying to get a simple connection going to my database. The database is fine but when I run my java program, all I see is, "Build Successful". I would like to display the information I put in my table. Thanks.
import java.sql.*; public class TestSQL { public static void main(String args[]) { try { // Load the JDBC driver Class.forName("src.com.mysql.jdbc.Driver"); System.out.println("---Driver loaded---"); //Establish Connection Connection connection = DriverManager.getConnection( "jdbc:mysql://localhost/test", "username", "password"); //Create a Statement Statement statement = connection.createStatement(); //Execute a Statement ResultSet rs = statement.executeQuery("SELECT * FROM people"); //Iterate through the results and display data while(rs.next()){ System.out.println(rs.getString(1) + rs.getString(2)); } //Close connection connection.close(); } catch (Exception e) { e.getMessage(); } } }