Hi
I have made I database to my program and need to call a sql statment that sends back from the database that it has that numbers of "xxx", want a main class and a gui with it if you know how to
please write asap.
to my java codepublic class library2 { private Connection connect = null; private Statement statement = null; private ResultSet resultSet = null; public void readDataBase() throws Exception { Connection con = null; Statement st = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql:///librarydb", "root", "123123"); st = con.createStatement(); rs = st.executeQuery("SELECT firstName, address, FROM customer"); while(rs.next()) { int userId = rs.getInt(1); String firstName = rs.getString(2); String address = rs.getString(3); System.out.println(userId + ". " + address + ", " + firstName); } } catch (Exception e) { System.err.println("Exception: " + e.getMessage()); } finally { try { if(rs != null) rs.close(); if(st != null) st.close(); if(con != null) con.close(); } catch (SQLException e) { } } } }