Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQL - how to return multiple rows with one SQL query?
- GLOBALSETTINGS
- ---------------------------------
- SessionTTL VARCHAR2(40 BYTE)
- MAXACTIVEUSERS NUMBER
- ACTIVEUSERS VARCHAR2(20 BYTE)
- public String CheckUserDB(String userToCheck) throws SQLException {
- String storedPassword = null;
- String SQL_Statement = null;
- if (ds == null) throw new SQLException();
- Connection conn = ds.getConnection();
- if (conn == null) throw new SQLException();
- try {
- conn.setAutoCommit(false);
- boolean committed = false;
- try {
- SQL_Statement = "SELECT Passwd from USERS WHERE Username = ?";
- PreparedStatement passwordQuery = conn.prepareStatement(SQL_Statement);
- passwordQuery.setString(1, userToCheck);
- ResultSet result = passwordQuery.executeQuery();
- if(result.next()){
- storedPassword = result.getString("Passwd");
- }
- conn.commit();
- committed = true;
- } finally {
- if (!committed) conn.rollback();
- }
- }
- finally {
- conn.close();
- }
- return storedPassword;
- }
- SELECT SessionTTL, MAXACTIVEUSERS, ACTIVEUSERS FROM GLOBALSETTINGS WHERE (condition)...
- SELECT * FROM GLOBALSETTINGS WHERE (condition)...
- string SqlAll = @"SELECT Database.SessionTTL, Database.MAXACTIVEUSERS, Database.ACTIVEUSERS FROM Database";
Add Comment
Please, Sign In to add comment