I`m having trouble with showing all the records from my database... I got database 'library' and table 'books'. Structure of 'members' : id, title, description, author, publisher, yearPublished.
Here is my java code method:
public static void preuzmi() throws ClassNotFoundException, InstantiationException, SQLException, IllegalAccessException{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/library", "root","");
Statement st = conn.createStatement();
st.executeQuery("select * from books");
ResultSet rs = st.getResultSet();
while(rs.next())
System.out.println(rs.getString("title"));
System.out.println(rs.getString("description"));
System.out.println(rs.getString("author"));
System.out.println(rs.getString("publisher"));
System.out.println(rs.getString("yearPublished"));
}
when i run this method preuzmi(); in main class it shows me only titles from db...
How can i show other records??? Please help me. THANKS IN ADVANCE!!!