Do the physical Open on this table (requery the table).
@exception DBException File exception.
765691
public void doOpen() throws DBException
    {
        try   {
    // FROM is automatic, since the remote BaseRecord is exactly the same as this one
    // ORDER BY
            KeyArea keyArea = this.getRecord().getKeyArea(-1);  // Current index
            String strKeyArea = null;
            boolean bDirection = DBConstants.ASCENDING;
            if (true)
            {
                strKeyArea = keyArea.getKeyName();
                bDirection = keyArea.getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder();
            }
            m_bDirectionCurrent = bDirection;
    // Open mode
            int iOpenMode = this.getRecord().getOpenMode();
    // SELECT (fields to select)
            String strFields = null;
            if (true) // All selected?
            {
                strFields = this.getRecord().getSQLFields(DBConstants.SQL_SELECT_TYPE, true);
                if (strFields.equals(" *"))
                    strFields = null; // Select all
            }
    // WHERE XYZ >=
            Object objInitialKey = null;
            if (true)
            {
                BaseBuffer buffer = new VectorBuffer(null);
                this.getRecord().handleInitialKey();
                if (keyArea.isModified(DBConstants.START_SELECT_KEY))
                {   // Anything set?
                    keyArea.setupKeyBuffer(buffer, DBConstants.START_SELECT_KEY, false);
                    objInitialKey = buffer.getPhysicalData();
                    buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.START_SELECT_KEY, false))); // Largest modified field.
                }
            }
    // WHERE XYZ <=
            Object objEndKey = null;
            if (true)
            {
                BaseBuffer buffer = new VectorBuffer(null);
                this.getRecord().handleEndKey();
                if (keyArea.isModified(DBConstants.END_SELECT_KEY))
                {   // Anything set?
                    keyArea.setupKeyBuffer(buffer, DBConstants.END_SELECT_KEY, false);
                    objEndKey = buffer.getPhysicalData();
                    buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.END_SELECT_KEY, false))); // Largest modified field.
                }
            }
    // WHERE XYZ
            byte[] byBehaviorData = null;
            boolean bDirty = false;
            if (this.getRecord().getListener() != null)
            {
                ByteArrayOutputStream baOut = new ByteArrayOutputStream();
                ObjectOutputStream daOut = new ObjectOutputStream(baOut);
                FileListener listener = (FileListener)this.getRecord().getListener();
                while (listener != null)
                {
                    if ((listener.getMasterSlaveFlag() & FileListener.RUN_IN_SLAVE) != 0) // Should exist in a SERVER environment
                        if ((listener.getMasterSlaveFlag() & FileListener.DONT_REPLICATE_TO_SLAVE) == 0) // Yes, replicate to the SERVER environment
                            if (listener.isEnabledListener()) // Yes, only replicate enabled listeners.
                    { // There should be a copy of this on the server
                        bDirty = true;
                        daOut.writeUTF(listener.getClass().getName());
                        listener.initRemoteStub(daOut);
                    }
                    listener = (FileListener)listener.getNextListener();
                }
                daOut.flush();
                if (bDirty)
                    byBehaviorData = baOut.toByteArray();
                daOut.close();
                baOut.close();
            }

            this.checkCacheMode(Boolean.TRUE);      // Make sure the cache is set up correctly for this type of query (typically needed)

            synchronized (this.getSyncObject())
            {   // In case this is called from another task
                m_tableRemote.open(strKeyArea, iOpenMode, bDirection, strFields, objInitialKey, objEndKey, byBehaviorData);
            }
        } catch (Exception ex) {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
84024
@Override
    public void open() throws Exception {
        lasReader = ALasReader.getReader(lasFile, crs);
        lasReader.open();
        lasHeader = lasReader.getHeader();
        isOpen = true;
    }
652482
public void readData(FieldTable table) throws DBException
    {
        if (this.getLookupKey() instanceof String)
        {
            FieldList record = table.getRecord();
            String strTableName = (String)this.getLookupKey();
            String strDBName = null;
            if (strTableName != null)
            {
                if (strTableName.lastIndexOf('/') != -1)
                {
                    strDBName = strTableName.substring(0, strTableName.lastIndexOf('/'));
                    if (strDBName.lastIndexOf('/') != -1)
                        strDBName = strDBName.substring(strDBName.lastIndexOf('/') + 1);
                    strTableName = strTableName.substring(strTableName.lastIndexOf('/') + 1);
                    if (strTableName.indexOf('.') != -1)
                        strTableName = strTableName.substring(0, strTableName.indexOf('.'));
                }
            }

            String strThickRecordClass = record.getClass().getName();
            
            RecordOwner recordOwner = ((Record)record).getRecordOwner();
            BaseDatabase database = (BaseDatabase)recordOwner.getDatabase(record.getDatabaseName(), record.getDatabaseType(), null);
            Record recSource = Record.makeRecordFromClassName(strThickRecordClass, recordOwner, false, true);
            if (recSource == null)
                return;
            if (strTableName != null)
                if (strTableName.length() > 0)
                    if ((!strTableName.equalsIgnoreCase(recSource.getTableNames(false))))
                        if ((recSource.getDatabaseType() & DBConstants.MAPPED) != 0)
                            recSource.setTableNames(strTableName);
            recSource.setTable(database.makeTable(recSource));
            recSource.init(recordOwner);

            recSource.populateThinTable(record, true);
            
            recSource.free();
        }
    }
1367876
public boolean hasNext() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.next();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
588455
public synchronized void set(FieldTable table) throws DBException
    {
        BaseBuffer bufferNew = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
        if (table.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS)
        {
            PKeyArea vKeyArea = this.getPKeyArea(Constants.MAIN_KEY_AREA);
            KeyAreaInfo primaryKeyArea = table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA);
            primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
            BaseBuffer bufferOld = vKeyArea.doSeek("==", table, primaryKeyArea);    // Get the old record back
            if ((bufferOld == null) || (bufferOld.getPhysicalData() == null))
                throw new DBException(Constants.INVALID_RECORD);    // This record had been freed (deleted)

            for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
            {
                try   {
                    vKeyArea = this.getPKeyArea(iKeyArea);
                    KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
                    keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);        // Move these keys back to the record
                    if (keyArea.getUniqueKeyCode() != Constants.UNIQUE)   // The main key is part of the comparison
                        primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
                    vKeyArea.doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                    bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                    vKeyArea.doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                } catch (DBException e)   {
                    if (e.getErrorCode() == Constants.DUPLICATE_KEY)
                    {
                        bufferOld.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                        this.getPKeyArea(iKeyArea).doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                        iKeyArea--;     // Duplicate key, back out all keys added so far!!!
                        while (iKeyArea >= Constants.MAIN_KEY_AREA)
                        {
                            vKeyArea = this.getPKeyArea(iKeyArea);
                            KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
                            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                            vKeyArea.doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                            keyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);        // Move these keys back to the record
                            if (keyArea.getUniqueKeyCode() != Constants.UNIQUE)   // The main key is part of the comparison
                                primaryKeyArea.reverseKeyBuffer(null, Constants.TEMP_KEY_AREA);     // Move these keys back to the record
                            vKeyArea.doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferOld);
                            iKeyArea--;
                        }
                    }
                    throw e;
                }
            }
            if (bufferNew != bufferOld)
                bufferOld.free();   // Get rid of the old one
            bufferOld = null;
            // Restore the record before returing (key.doWrite probably changed it).
            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
        }
        else
            throw new DBException(Constants.INVALID_RECORD);
    }
366065
private synchronized void open(Execution event, String dsn) throws SQLException, PersistenceException {
        try {
            Connection conn;
            
            if( connection != null ) {
                return;
            }
            state = "OPENING";
            try {
                InitialContext ctx = new InitialContext();
                DataSource ds;
                
                if( dsn == null ) {
                    dsn = event.getDataSource();
                }
                if (dsn == null) {
                    throw new PersistenceException("No data source name");
                }
                state = "LOOKING UP";
                ds = dsCache.get(dsn);
                if (ds == null) {
                    ds = (DataSource)ctx.lookup(dsn);
                    if (ds != null) {
                        dsCache.put(dsn, ds);
                    }
                }
                if (ds == null) {
                    throw new PersistenceException("Could not find data source: " + dsn);
                }
                conn = ds.getConnection();
                openTime = System.currentTimeMillis();
                if( logger.isDebugEnabled() ) {
                    logger.debug("DPTRANSID-" + transactionId + " connection.get - dsn='" + dsn + '\'');
                }
                state = "CONNECTED";
            }
            catch( NamingException e ) {
                logger.error("Problem with datasource: " + e.getMessage());
                throw new PersistenceException(e.getMessage());
            }
            conn.setAutoCommit(false);
            conn.setReadOnly(readOnly);
            connection = conn;
            if (tracking) {
                connections.incrementAndGet();
                transactions.put(new Integer(transactionId), this);
            }
        }
        finally {
        }
    }
208434
private boolean handleOpenLogSQLException(SQLException sqlex) throws InterruptedException {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "handleOpenLogSQLException", new java.lang.Object[] { sqlex, this });

        boolean retryBatch = true;
        boolean failAndReport = false;
        int batchRetries = 0;

        // Set the exception that will be reported
        _nonTransientExceptionAtOpen = sqlex;

        Connection conn = null;

        while (retryBatch && !failAndReport && batchRetries < _transientRetryAttempts) {
            // Should we attempt to reconnect? This method works through the set of SQL exceptions and will
            // return TRUE if we determine that a transient DB error has occurred
            retryBatch = sqlTransientErrorHandlingEnabled && isSQLErrorTransient(sqlex);
            batchRetries++;
            if (retryBatch) {
                if (tc.isDebugEnabled())
                    Tr.debug(tc, "Try to reexecute the SQL using connection from DS: " + _theDS + ", attempt number: " + batchRetries);
                if (_theDS != null) {
                    // Re-execute the SQL
                    try {
                        // Get a connection to database via its datasource
                        conn = _theDS.getConnection();
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Acquired connection in Database retry scenario");
                        conn.setAutoCommit(false);
                        Statement lockingStmt = conn.createStatement();

                        // Use RDBMS SELECT FOR UPDATE to lock table for recovery
                        String queryString = "SELECT SERVER_NAME" +
                                             " FROM " + _recoveryTableName + _logIdentifierString + _recoveryTableNameSuffix +
                                             " WHERE RU_ID=" + "-1 FOR UPDATE";
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Attempt to select the HA LOCKING ROW for UPDATE - " + queryString);
                        ResultSet lockingRS = lockingStmt.executeQuery(queryString);
                        // Update the HA DB lock and then recover
                        updateHADBLock(conn, lockingStmt, lockingRS);

                        // Clear out recovery caches in case they were partially filled before the failure.
                        _recoverableUnits.clear();
                        _recUnitIdTable = new RecoverableUnitIdTable();

                        // Drive recover again
                        recover(conn);

                        conn.commit();
                        // The Batch has executed successfully and we can continue processing
                        retryBatch = false;
                    } catch (SQLException sqlex2) {
                        // We've caught another SQLException. Assume that we've retried the connection too soon.
                        // Make sure we inspect the latest exception
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "reset the sqlex to " + sqlex2);
                        sqlex = sqlex2;
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "sleeping for " + _transientRetrySleepTime + " millisecs");
                        Thread.sleep(_transientRetrySleepTime);
                    } catch (Throwable exc) {
                        // Not a SQLException, break out of the loop and report the exception
                        if (tc.isDebugEnabled())
                            Tr.debug(tc, "Failed got exception: " + exc);
                        for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
                            if (tc.isDebugEnabled())
                                Tr.debug(tc, " " + ste);
                        }

                        failAndReport = true;
                        _nonTransientExceptionAtOpen = exc;
                    } finally {
                        // Tidy up the connection and its artefacets, if we can but allow
                        // processing to continue on the pre-determined path if we cannot.
                        if (conn != null) {
                            if (retryBatch) {
                                // Attempt a rollback. If it fails, trace the failure but allow processing to continue
                                try {
                                    conn.rollback();
                                } catch (Throwable exc) {
                                    // Trace the exception
                                    if (tc.isDebugEnabled())
                                        Tr.debug(tc, "Rollback Failed, when handling OpenLog SQLException, got exception: " + exc);
                                }
                            }
                            // Attempt a close. If it fails, trace the failure but allow processing to continue
                            try {
                                conn.close();
                            } catch (Throwable exc) {
                                // Trace the exception
                                if (tc.isDebugEnabled())
                                    Tr.debug(tc, "Close Failed, when handling OpenLog SQLException, got exception: " + exc);
                            }
                        }
                    }
                } else {
                    // This is unexpected and catastrophic, the reference to the DataSource is null
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, "NULL DataSource reference");
                    failAndReport = true;
                }
            } else
                failAndReport = true;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "handleOpenLogSQLException", failAndReport);
        return failAndReport;
    }
153201
@Override
	public void open(InputSplit ignored) throws IOException {
		try {
			establishConnection();
			statement = dbConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
			resultSet = statement.executeQuery(query);
		} catch (SQLException se) {
			close();
			throw new IllegalArgumentException("open() failed." + se.getMessage(), se);
		} catch (ClassNotFoundException cnfe) {
			throw new IllegalArgumentException("JDBC-Class not found. - " + cnfe.getMessage(), cnfe);
		}
	}
397889
public void doSet(Record record) throws DBException
    {
        try   {
            BaseBuffer buffer = (BaseBuffer)m_dataSource;
            Object data = buffer.getPhysicalData();
            synchronized (this.getSyncObject())
            {   // In case this is called from another task
                m_tableRemote.set(data, this.getRecord().getOpenMode());
            }
        } catch (Exception ex) {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
411333
public void run()
    {

        String strURL = this.getProperty(DBParams.URL);
        String strOut = this.getProperty("out");
        
        this.moveThisFile(strURL, strOut);
    }
1330708
private synchronized void open() throws DatabaseException {
        try {
            if (!isOpen()) {
                connection = connectionFactory.getConnection();
                final String databaseProductName = determineDatabaseProductName(this.connection);
                statementBundle = databaseProductName != null
                        ? ResourceBundle.getBundle("data/dbStatements", new Locale(databaseProductName))
                        : ResourceBundle.getBundle("data/dbStatements");
                prepareStatements();
                databaseProperties = new DatabaseProperties(this);
            }
        } catch (DatabaseException e) {
            releaseResources();
            throw e;
        }
    }
584315
protected void openConnection() throws SQLException {
        if (connection == null) {
            try {
                Class.forName(configuration.getJdbcDriver());
            } catch (NullPointerException npe) {
                throw new RuntimeException("error while lookup jdbc driver class. jdbc driver is not configured.", npe);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException("jdbc driver not found", e);
            }

            connection = DriverManager.getConnection(configuration.getJdbcUrl(), configuration.getJdbcUser(),
                    configuration.getJdbcPassword());
            connection.setAutoCommit(false);
        }
    }
820775
public void doRemove() throws DBException
    {
        try   {
            m_objLastModBookmark = null;
            m_tableRemote.remove(null, this.getRecord().getOpenMode());
        } catch (RemoteException ex) {
            throw new DBException(ex.getMessage());
        }
    }
1130137
public void reconnect() throws SQLException {
    try {
      listener.reconnect();
    } catch (SQLException e) {
      ExceptionMapper.throwException(e, null, null);
    }
  }
106627
public void start() throws Exception{
		if(cleanupDirectory){
			CleanUp.start(conf);
		}
		IDatabaseDev db = (IDatabaseDev) em.getDB();//TODO make sure DB platform can be used for development
		ModelDefinitionProvider provider = new ModelDefinitionProvider(db, conf.dbUser, null, conf.includeSchema);
		ModelDef[] origModelList = provider.getTableDefinitions();
		
		new ModelMetaDataGenerator().start(origModelList, conf);
		//TODO: proper support for explicit ModelDefinitions
		ModelDef[] withExplecitList = overrideModelDefFromExplicit(origModelList, explicitMeta);
		ModelDef[] modelList = correctModelList(withExplecitList);
		
		new DAOClassGenerator().start(modelList, conf, true, false);
		new BeanGenerator().start(modelList, conf);
		new MapperGenerator().start(modelList, conf);

		ModelDef[] modelListOwned = setModelOwners(modelList, tableGroups);
		ModelDef[] modelListChilded = setDirectChildren(modelListOwned);

		new ColumnNameGenerator().start(modelListChilded, conf);
		new TableNameGenerator().start(modelListChilded, conf);
		new SchemaTableGenerator().start(modelListChilded, conf);
		new TableColumnGenerator().start(modelListChilded, conf);
		//new ModelMetaDataGenerator().start(modelListChilded, conf);
		
		new DAOInstanceFactoryGenerator().start(modelListChilded, conf);
		new ModelToDAOConversionGenerator().start(modelListChilded, conf);
	}
693044
public SQLException exceptionWithQuery(ByteBuffer buffer, SQLException sqlEx,
      boolean explicitClosed) {
    if (options.dumpQueriesOnException || sqlEx.getErrorCode() == 1064 || explicitClosed) {
      return exceptionWithQuery(subQuery(buffer), sqlEx, explicitClosed);
    }
    return sqlEx;
  }
111408
public void readData(FieldTable table) throws DBException
    {
        if (this.getLookupKey() instanceof String)
        {
            try
            {
                FieldList record = table.getRecord();
                String strFilePath = (String)this.getLookupKey();
                String strFilePathName = this.getPDatabase().getFilename(strFilePath, false);
                File file = new File(strFilePathName);
                if (file.exists())
                {
                    XmlInOut inOut = new XmlInOut(null, null, null);
                    boolean bSuccess = inOut.importXML(((Record)record).getTable(), strFilePathName, null);
                    inOut.free();
                    if (!bSuccess)
                    {
                        // Ignore (for now)
                    }
                    this.fixCounter(table);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }