Package oracle.jdbc.driver

Examples of oracle.jdbc.driver.OracleConnection


    public Connection connect(String s, Properties properties) throws SQLException{
        if (getDriver() == null)
            return null;

        //has to return null if no connection available for compliance with the JDBC appi
        OracleConnection con = (OracleConnection) getDriver().connect(s, properties);
        if (con != null)
            return new JdbcLoggerOracleConnectionWrapper(con, formatters);
        return null;

    }
View Full Code Here


      if(connection==null ){
        result.setFailed(OLAP_CONNECTION_NOT_AVAILABLE);
        return result;
      }
     
      OracleConnection conn = (OracleConnection) connection;
      try{
        awConnection = new AWConnection(conn);
      }catch(Exception e){
        result.setFailed(e.getMessage());
        e.printStackTrace();
        return result;
      }
      Interaction curInteraction = new Interaction();

        // Set the AWConnection to use when building the analytic workspace.
        curInteraction.setConnection(awConnection);

        // Create an BuildDatabase object.
        BuildDatabase myBuild =
                 (BuildDatabase)curInteraction.createAction("BUILDDATABASE");

        // Set the name of the analytic workspace.
        myBuild.setAWName(WebVariable.AW_GLOBAL_ID);//挂载分析空间global.global

        // Specify not running solves when building the database.
       
        myBuild.setBuildType("EXECUTE");
//        myBuild.setRunSolve(true);
        myBuild.setCleanMeasures(false);
        myBuild.setCleanAttrs(false);
        myBuild.setCleanDim(true);
        myBuild.setTrackStatus(true);
       
//        myBuild.setId("simple");
        /**!
         * TrackStatus
         * true只导入增量数据
         * false全数据导入
         */
//        myBuild.setTrackStatus(isFull);
        myBuild.setMaxJobQueues(0);
        if(dims!=null){
          for(String dimid:dims){
            Dimension dim = new Dimension();
            dim.setId(dimid);
            myBuild.addBuildList(dim);
          }
        }
        if(cubes!=null){
          for(String cubeid:cubes){
            Cube cube = new Cube();
            cube.setId(cubeid);
            myBuild.addBuildList(cube);
          }
        }
       
        myBuild.Execute();
        awConnection.executeCommand("aw detach "+WebVariable.AW_GLOBAL_ID);
        result.setSucceed(getOLAPLog(conn));
        awConnection.close();
        conn.close();
       
    } catch (Exception e) {
      e.printStackTrace();
      result.setFailed(OLAP_MAINTAIN_FAILED,e.getMessage());
    } finally{
View Full Code Here

      if(connection==null || !(connection instanceof OracleConnection)){
        result.setFailed(OLAP_CONNECTION_NOT_AVAILABLE);
        return result;
      }
      OracleConnection conn = (OracleConnection) connection;
      try{
        awConnection = new AWConnection(conn);
      }catch(Exception e){
        result.setFailed(e.getMessage());
        e.printStackTrace();
        return result;
      }
      Interaction curInteraction = new Interaction();

        // Set the AWConnection to use when building the analytic workspace.
        curInteraction.setConnection(awConnection);

        // Create an BuildDatabase object.
        BuildDatabase myBuild =
                 (BuildDatabase)curInteraction.createAction("BUILDDATABASE");

        // Set the name of the analytic workspace.
        myBuild.setAWName(WebVariable.AW_GLOBAL_ID);//挂载分析空间global.global

        // Specify not running solves when building the database.
       
        myBuild.setBuildType("EXECUTE");
        myBuild.setRunSolve(true);
       
        if(solveGroups!=null)
        {
          for(String solveGroupid:solveGroups)
          {
            SolveGroup solveGroup = new SolveGroup();//计算计划属于SolveGroup型
            solveGroup.setId(solveGroupid);
            myBuild.addBuildList(solveGroup);
          }
        }
        myBuild.Execute();
        awConnection.executeCommand("aw detach "+WebVariable.AW_GLOBAL_ID);
        result.setSucceed(getOLAPLog(conn));
        awConnection.close();
        conn.close();
    }
    catch (Exception e)
    {
      e.printStackTrace();
      result.setFailed(CALCULATE_PLAN_EXECUTE_FAILED,e.getMessage());
View Full Code Here

            }
        }
        Accessor accessor = databaseSession.getAccessor();
        accessor.incrementCallCount(databaseSession);
        try {
            OracleConnection connection = (OracleConnection)databaseSession.getServerPlatform().unwrapConnection(accessor.getConnection());
            databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_registering");
            Properties properties = new Properties();
            properties.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true");
            properties.setProperty(OracleConnection.DCN_IGNORE_INSERTOP, "true");
            try {
                // Register with the database change notification, the connection is not relevant, the events occur after the connection is closed,
                // and a different connection can be used to unregister the event listener.
                this.register = connection.registerDatabaseChangeNotification(properties);
                final List<DatabaseField> fields = new ArrayList<DatabaseField>();
                fields.add(new DatabaseField(ROWID));
                this.register.addListener(new DatabaseChangeListener() {               
                    public void onDatabaseChangeNotification(DatabaseChangeEvent changeEvent) {
                        databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_change_event", changeEvent);
                        if (changeEvent.getTableChangeDescription() != null) {
                            for (TableChangeDescription tableChange : changeEvent.getTableChangeDescription()) {
                                ClassDescriptor descriptor = OracleChangeNotificationListener.this.descriptorsByTable.get(new DatabaseTable(tableChange.getTableName()));
                                if (descriptor != null) {
                                    CacheIndex index = descriptor.getCachePolicy().getCacheIndex(fields);                               
                                    for (RowChangeDescription rowChange : tableChange.getRowChangeDescription()) {
                                        CacheId id = new CacheId(new Object[]{rowChange.getRowid().stringValue()});
                                        CacheKey key = databaseSession.getIdentityMapAccessorInstance().getIdentityMapManager().getCacheKeyByIndex(
                                                index, id, true, descriptor);
                                        if (key != null) {
                                            if ((key.getTransactionId() == null) || !key.getTransactionId().equals(changeEvent.getTransactionId(true))) {
                                                databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_invalidate", key.getKey(), descriptor.getJavaClass().getName());
                                                key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
                // Register each table for database events, this is done by executing a select from the table.
                for (DatabaseTable table : this.descriptorsByTable.keySet()) {
                    OracleStatement statement = (OracleStatement)connection.createStatement();
                    statement.setDatabaseChangeRegistration(this.register);               
                    try {
                        statement.executeQuery("SELECT ROWID FROM " + table.getQualifiedName()).close();
                        databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_register_table", table.getQualifiedName());
                    } catch (Exception failed) {
View Full Code Here

        }
        AbstractSession databaseSession = (AbstractSession)session;
        Accessor accessor = databaseSession.getAccessor();
        accessor.incrementCallCount(databaseSession);
        try {
            OracleConnection connection = (OracleConnection)databaseSession.getServerPlatform().unwrapConnection(accessor.getConnection());
            databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_unregister");
            try {
                connection.unregisterDatabaseChangeNotification(this.register);
            } catch (SQLException exception) {
                throw DatabaseException.sqlException(exception, databaseSession.getAccessor(), databaseSession, false);
            }
        } finally {
            accessor.decrementCallCount();           
View Full Code Here

            }
        }
        Accessor accessor = databaseSession.getAccessor();
        accessor.incrementCallCount(databaseSession);
        try {
            OracleConnection connection = (OracleConnection)databaseSession.getServerPlatform().unwrapConnection(accessor.getConnection());
            databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_registering");
            Properties properties = new Properties();
            properties.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true");
            properties.setProperty(OracleConnection.DCN_IGNORE_INSERTOP, "true");
            try {
                // Register with the database change notification, the connection is not relevant, the events occur after the connection is closed,
                // and a different connection can be used to unregister the event listener.
                this.register = connection.registerDatabaseChangeNotification(properties);
                final List<DatabaseField> fields = new ArrayList<DatabaseField>();
                fields.add(new DatabaseField(ROWID));
                this.register.addListener(new DatabaseChangeListener() {               
                    public void onDatabaseChangeNotification(DatabaseChangeEvent changeEvent) {
                        databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_change_event", changeEvent);
                        if (changeEvent.getTableChangeDescription() != null) {
                            for (TableChangeDescription tableChange : changeEvent.getTableChangeDescription()) {
                                ClassDescriptor descriptor = OracleChangeNotificationListener.this.descriptorsByTable.get(new DatabaseTable(tableChange.getTableName()));
                                if (descriptor != null) {
                                    CacheIndex index = descriptor.getCachePolicy().getCacheIndex(fields);                               
                                    for (RowChangeDescription rowChange : tableChange.getRowChangeDescription()) {
                                        CacheId id = new CacheId(new Object[]{rowChange.getRowid().stringValue()});
                                        CacheKey key = databaseSession.getIdentityMapAccessorInstance().getIdentityMapManager().getCacheKeyByIndex(
                                                index, id, true, descriptor);
                                        if (key != null) {
                                            if ((key.getTransactionId() == null) || !key.getTransactionId().equals(changeEvent.getTransactionId(true))) {
                                                databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_invalidate", key.getKey(), descriptor.getJavaClass().getName());
                                                key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
                // Register each table for database events, this is done by executing a select from the table.
                for (DatabaseTable table : this.descriptorsByTable.keySet()) {
                    OracleStatement statement = (OracleStatement)connection.createStatement();
                    statement.setDatabaseChangeRegistration(this.register);               
                    try {
                        statement.executeQuery("SELECT ROWID FROM " + table.getQualifiedName()).close();
                        databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_register_table", table.getQualifiedName());
                    } catch (Exception failed) {
View Full Code Here

        }
        AbstractSession databaseSession = (AbstractSession)session;
        Accessor accessor = databaseSession.getAccessor();
        accessor.incrementCallCount(databaseSession);
        try {
            OracleConnection connection = (OracleConnection)databaseSession.getServerPlatform().unwrapConnection(accessor.getConnection());
            databaseSession.log(SessionLog.FINEST, SessionLog.CONNECTION, "dcn_unregister");
            try {
                connection.unregisterDatabaseChangeNotification(this.register);
            } catch (SQLException exception) {
                throw DatabaseException.sqlException(exception, databaseSession.getAccessor(), databaseSession, false);
            }
        } finally {
            accessor.decrementCallCount();           
View Full Code Here

TOP

Related Classes of oracle.jdbc.driver.OracleConnection

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.