Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

ResultSet rs = ps.executeQuery()

public void runQuery(String url, String sql) {
  try (Connection connection = DriverManager.getConnection(url);
     PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
    // ... add parameters to the SQL query using PreparedStatement methods:
    //     setInt, setString, etc.
    try (ResultSet resultSet = preparedStatement.executeQuery()) {
      while (resultSet.next()) {
        // ... do something with result set
      }
    }
  } catch (SQLException e) {
    // ... handle SQL exception
  }
}
Source by www.tabnine.com #
 
PREVIOUS NEXT
Tagged: #ResultSet #rs
ADD COMMENT
Topic
Name
2+5 =