Create a ResultSet
In this chapter you will learn:
Create ResultSet
JDBC provides following connection methods to create statements with desired ResultSet:
createStatement(int resultSetType, int resultSetConcurrencyType);
prepareStatement(String sql, int resultSetType, int resultSetConcurrencyType);
prepareCall(String sql, int resultSetType, int resultSetConcurrencyType);
The following code creates a Statement object which will create a forward-only, read only ResultSet object.
try {// j a v a2s . co m
Statement stmt = conn.createStatement(
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
}
catch(Exception ex) {
....
}
finally {
....
}
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » Statements, ResultSet, Exception, Warning