Package org.apache.derby.iapi.db

Examples of org.apache.derby.iapi.db.Database


      // if we are shutting down don't attempt to boot or create the database
      boolean shutdown = Boolean.valueOf(info.getProperty(Attribute.SHUTDOWN_ATTR)).booleanValue();

      // see if database is already booted
      Database database = (Database) Monitor.findService(Property.DATABASE_MODULE, tr.getDBName());

      // See if user wants to create a new database.
      boolean  createBoot = createBoot(info)

      // DERBY-2264: keeps track of whether we do a plain boot before an
View Full Code Here


     *
     * @return 0 if there is no database, the engine type otherwise. @see org.apache.derby.iapi.reference.EngineType
     */
    public int getEngineType()
    {
        Database db = getDatabase();

        if( null == db)
            return 0;
        return db.getEngineType();
    }
View Full Code Here

      // clear these values as some modules hang onto
      // the properties set corresponding to service.properties
      // and they shouldn't be interested in these JDBC attributes.
      info.clear();

      Database database = (Database) Monitor.findService(Property.DATABASE_MODULE, dbname);
      tr.setDatabase(database);

    } catch (StandardException mse) {

      Throwable ne = mse.getCause();
View Full Code Here

        {
            //Doing check for lcc and db to be certain
            LanguageConnectionContext lcc = getLCC();
            if (lcc != null)
            {
                Database db = lcc.getDatabase();
                boolean isactive = (db != null ? db.isActive() : false);
                lcc.getContextManager().cleanupOnError(se, isactive);
            }
        }
    }
View Full Code Here

        String dbName = getDatabaseName();
        if (dbName != null) {

          // see if database already booted, if it is, then don't make a
          // connection.
          Database database = null;

          // if monitor is never setup by any ModuleControl, getMonitor
          // returns null and no Derby database has been booted.
          if (Monitor.getMonitor() != null)
            database = (Database)
              Monitor.findService(Property.DATABASE_MODULE, dbName);

          if (database == null)
          {
            // If database is not found, try connecting to it.  This
            // boots and/or creates the database.  If database cannot
            // be found, this throws SQLException.
            if (requestPassword)
              getConnection(user, password).close();
            else
              getConnection().close();

            // now try to find it again
            database = (Database)
              Monitor.findService(Property.DATABASE_MODULE, dbName);
          }

          if (database != null)
            ra = (ResourceAdapter) database.getResourceAdapter();
        }

        if (ra == null)
          throw new SQLException(MessageService.getTextMessage(MessageId.CORE_DATABASE_NOT_AVAILABLE),
                       "08006",
View Full Code Here

      // if we are shutting down don't attempt to boot or create the database
      boolean shutdown = Boolean.valueOf(info.getProperty(Attribute.SHUTDOWN_ATTR)).booleanValue();

      // see if database is already booted
      Database database = (Database) Monitor.findService(Property.DATABASE_MODULE, tr.getDBName());

      // See if user wants to create a new database.
      boolean  createBoot = createBoot(info)

      // DERBY-2264: keeps track of whether we do a plain boot before an
      // (re)encryption or hard upgrade boot to (possibly) authenticate
      // first. We can not authenticate before we have booted, so in
      // order to enforce data base owner powers over encryption or
      // upgrade, we need a plain boot, then authenticate, then, if all
      // is well, boot with (re)encryption or upgrade.  Encryption at
      // create time is not checked.
      boolean isTwoPhaseEncryptionBoot = (!createBoot &&
                        isEncryptionBoot(info));
      boolean isTwoPhaseUpgradeBoot = (!createBoot &&
                       isHardUpgradeBoot(info));
      boolean isStartSlaveBoot = isStartReplicationSlaveBoot(info);
            // Set to true if startSlave command is attempted on an
            // already booted database. Will raise an exception when
            // credentials have been verified
            boolean slaveDBAlreadyBooted = false;

            boolean isFailoverMasterBoot = false;
            boolean isFailoverSlaveBoot = false;
            final boolean dropDatabase = isDropDatabase(info);

            // Don't allow both the shutdown and the drop attribute.
            if (shutdown && dropDatabase) {
                throw newSQLException(
                        SQLState.CONFLICTING_BOOT_ATTRIBUTES,
                        Attribute.SHUTDOWN_ATTR + ", " + Attribute.DROP_ATTR);
            }

            // check that a replication operation is not combined with
            // other operations
            String replicationOp = getReplicationOperation(info);
            if (replicationOp!= null) {
                if (createBoot ||
                    shutdown ||
                    dropDatabase ||
                    isTwoPhaseEncryptionBoot ||
                    isTwoPhaseUpgradeBoot) {
                    throw StandardException.
                        newException(SQLState.
                                     REPLICATION_CONFLICTING_ATTRIBUTES,
                                     replicationOp);
                }
            }

            if (isReplicationFailover(info)) {
                // Check that the database has been booted - otherwise throw
                // exception.
                checkDatabaseBooted(database,
                                    Attribute.REPLICATION_FAILOVER,
                                    tr.getDBName());
                // The failover command is the same for master and slave
                // databases. If the db is not in slave replication mode, we
                // assume that it is in master mode. If not in any replication
                // mode, the connection attempt will fail with an exception
                if (database.isInSlaveMode()) {
                    isFailoverSlaveBoot = true;
                } else {
                    isFailoverMasterBoot = true;
                }
            }
View Full Code Here

     *
     * @return 0 if there is no database, the engine type otherwise. @see org.apache.derby.iapi.reference.EngineType
     */
    public int getEngineType()
    {
        Database db = getDatabase();

        if( null == db)
            return 0;
        return db.getEngineType();
    }
View Full Code Here

      // clear these values as some modules hang onto
      // the properties set corresponding to service.properties
      // and they shouldn't be interested in these JDBC attributes.
      info.clear();

      Database database = (Database) Monitor.findService(Property.DATABASE_MODULE, dbname);
      tr.setDatabase(database);

    } catch (StandardException mse) {

      Throwable ne = mse.getCause();
View Full Code Here

      // if we are shutting down don't attempt to boot or create the database
      boolean shutdown = Boolean.valueOf(info.getProperty(Attribute.SHUTDOWN_ATTR)).booleanValue();

      // see if database is already booted
      Database database = (Database) Monitor.findService(Property.DATABASE_MODULE, tr.getDBName());

      // See if user wants to create a new database.
      boolean  createBoot = createBoot(info)

      // DERBY-2264: keeps track of whether we do a plain boot before an
View Full Code Here

     *
     * @return 0 if there is no database, the engine type otherwise. @see org.apache.derby.iapi.reference.EngineType
     */
    public int getEngineType()
    {
        Database db = getDatabase();

        if( null == db)
            return 0;
        return db.getEngineType();
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.db.Database

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.