Package com.sun.messaging.jmq.jmsserver.persist.jdbc

Examples of com.sun.messaging.jmq.jmsserver.persist.jdbc.DBManager


    /**
     */
    public JMSBGDAOImpl() throws BrokerException {

        DBManager dbMgr = DBManager.getDBManager();

        tableName = dbMgr.getTableName(TABLE_NAME_PREFIX);

        insertSQL = new StringBuffer(128)
            .append( "INSERT INTO " ).append( tableName )
            .append( " ( " )
            .append( NAME_COLUMN ).append( ", " )
View Full Code Here


        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(true);
                myconn = conn;
            }

            try {
                pstmt = conn.prepareStatement(insertSQL);
                pstmt.setString(1, name);
                pstmt.setString(2, dbMgr.getBrokerID());
                pstmt.setLong(3, System.currentTimeMillis());
                pstmt.setLong(4, 0L);
                pstmt.executeUpdate();
            } catch (Exception e) {
                myex = e;
View Full Code Here

        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(true);
                myconn = conn;
            }

            pstmt = conn.prepareStatement(updateBrokerIdSQL);
            pstmt.setString(1, newBrokerId);
            pstmt.setLong(2, System.currentTimeMillis());
            pstmt.setString(3, name);
            pstmt.setString(4, expectedBrokerId);
            if (Globals.getHAEnabled()) {
                pstmt.setString(5, dbMgr.getBrokerID());
            }

            if (pstmt.executeUpdate() == 0) {
                Util.checkBeingTakenOver(conn, dbMgr, logger, logger_);
                throw new KeyNotFoundException(
View Full Code Here

        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(true);
                myconn = conn;
            }

            pstmt = conn.prepareStatement(deleteSQL);
            pstmt.setString(1, name);
            pstmt.setString(2, dbMgr.getBrokerID());
            if (pstmt.executeUpdate() == 0) {
                throw new KeyNotFoundException("Name "+name+" not found in store ");
            }
        } catch (Exception e) {
            myex = e;
View Full Code Here

     * @param conn database connection
     * @throws BrokerException
     */
    public void deleteAll(Connection conn) throws BrokerException {

        DBManager dbMgr = DBManager.getDBManager();

        String whereClause = new StringBuffer(128)
               .append( BROKER_ID_COLUMN ).append( " = '" )
               .append( dbMgr.getBrokerID() ).append( "'" )
               .toString();
        deleteAll(conn, whereClause, null, 0);
    }
View Full Code Here

        Connection myconn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = DBManager.getDBManager().getConnection(true);
                myconn = conn;
            }
View Full Code Here

    /**
     */
    public TMLogRecordDAOJMSBG() throws BrokerException {

        DBManager dbMgr = DBManager.getDBManager();

        tableName = dbMgr.getTableName(TABLE_NAME_PREFIX);

        insertSQL = new StringBuffer(128)
            .append( "INSERT INTO " ).append( tableName )
            .append( " ( " )
            .append( XID_COLUMN ).append( ", " )
View Full Code Here

        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(true);
                myconn = conn;
            }

            try {
                pstmt = conn.prepareStatement(insertSQL);
                pstmt.setString(1, xid);
                pstmt.setBytes(2, logRecord);
                pstmt.setString(3, name);
                pstmt.setString(4, dbMgr.getBrokerID());
                pstmt.setLong(5, System.currentTimeMillis());
                pstmt.setLong(6, 0L);
                pstmt.executeUpdate();
            } catch (Exception e) {
                myex = e;
View Full Code Here

                                Exception {
        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(false);
                myconn = conn;
            }
            if (conn.getAutoCommit()) {
                throw new BrokerException(
                "Broker Internal Error: Unexpected auto commit SQL connection for update TM log record: "+xid);
            }
            byte[] currLogRecord = null;
      currLogRecord = getLogRecord(conn, xid, name, logger_);
            if (currLogRecord == null) {
                if (addIfNotExist) {
                    insert(conn, xid, logRecord, name, logger_);
                    return;
                }
                throw new KeyNotFoundException("TM log record not found for "+xid);
            }
            byte[] newLogRecord = (byte[])callback.update(currLogRecord);

            pstmt = conn.prepareStatement(updateLogRecordSQL);
            pstmt.setBytes(1, newLogRecord);
            pstmt.setLong(2, System.currentTimeMillis());
            pstmt.setString(3, xid);
            pstmt.setString(4, dbMgr.getBrokerID());

            if (pstmt.executeUpdate() == 0) {
                Util.checkBeingTakenOver(conn, dbMgr, logger, logger_);
                throw new BrokerException(
                br.getKString("TM Log record not found in store for "+xid), Status.NOT_FOUND);
View Full Code Here

        Connection myconn = null;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            DBManager dbMgr = DBManager.getDBManager();
            if (conn == null) {
                conn = dbMgr.getConnection(true);
                myconn = conn;
            }

            pstmt = conn.prepareStatement(deleteSQL);
            pstmt.setString(1, xid);
            pstmt.setString(2, dbMgr.getBrokerID());
            if (pstmt.executeUpdate() == 0) {
                throw new KeyNotFoundException(
                "TM log record not found in store for "+xid);
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.persist.jdbc.DBManager

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.