View RSS Feed

Recent Blogs Posts

  1. JDBC: Query the Database

    by , 04-27-2012 at 08:03 PM
    Querying a database means searching through its data. You do so be sending SQL statements to the database. Once you have an open connection, you need to create a Statement object, like this:
    Java Code:
    Statement statement = connection.createStatement();
    Once you have created the Statement you can use it to execute SQL queries, like this:
    Java Code:
    String sql = "select * from people";
    
    ResultSet result = statement.executeQuery(sql);
    ...
    Categories
    Query