Package org.sd_network.db

Examples of org.sd_network.db.DBException


                        rs.getString("login_name"),
                        rs.getBoolean("is_admin"));
            }
            return user;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (con != null)
                    con.close();
            } catch (SQLException e) {
View Full Code Here


        Connection con = pool.engageConnection(10);
        try {
            con.setAutoCommit(true);
            return create(con, loginName, password, isAdmin);
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (con != null)
                    con.close();
            } catch (SQLException e) {
View Full Code Here

        columnMap.put("user_id", userID);
        columnMap.put("login_name", loginName);
        columnMap.put("password", password);
        columnMap.put("is_admin", new Boolean(isAdmin));
        if (DBUtil.insert(con, "user", columnMap) != 1)
            throw new DBException("new user could not insert to db.");
        return new User(userID, loginName, isAdmin);
    }
View Full Code Here

            try {
                con.rollback();
            } catch (SQLException e1) {
                _log.log(Level.SEVERE, "Connection could not rollback.",e1);
            }
            throw new DBException(e);
        } finally {
            try {
                if (con != null)
                    con.close();
            } catch (SQLException e1) {
View Full Code Here

                        "Sector not found when retrive content. sectorID = " +
                        _sectorID);
            _content = rs.getBytes("content");
            return _content;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

                    5, new ByteArrayInputStream(content), size);
            stmt.executeUpdate();
            _log.info("Sector created : " + sectorID);
            return sectorID;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

            if (!rs.next())
                throw new IllegalStateException(
                        "Sector not found. sectorID = " + sectorID);
            return rs.getBytes("content");
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

                    2, new ByteArrayInputStream(content), size);
            stmt.setString(3, sectorID);
            stmt.executeUpdate();
            return sectorID;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

            Sector lastSector = null;
            if (rs.next())
                lastSector = getInstance(rs);
            return lastSector;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

            long size = 0;
            if (rs.next())
                size = rs.getLong("total_bytes");
            return size;
        } catch (SQLException e) {
            throw new DBException(e);
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                con.close();
View Full Code Here

TOP

Related Classes of org.sd_network.db.DBException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.