Slip No 30
Slip No 30
Slip No 30
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------
class Counter {
private int count = 0;
@Override
public void run() {
for (int i = 0; i < increments; i++) {
counter.increment();
}
}
}
output
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
---------------------------------------------------------------------
2. Write a Java Program for the implementation of scrollable ResultSet. Assume
Teacher
table with attributes (TID, TName, Salary) is already created.
-----------------------------------------------------------------------------------
----------------------------------------------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
// JDBC variables
try (Connection connection = DriverManager.getConnection(url, username,
password);
Statement statement =
connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet resultSet = statement.executeQuery(query)) {
} catch (SQLException e) {
e.printStackTrace();
}
}
}
===================================================================================
============================================================================
output