Package oracle.jdbc

Examples of oracle.jdbc.OracleConnection


     * INTERNAL:
     * Clears both implicit and explicit caches of OracleConnection
     */
    public void clearOracleConnectionCache(Connection conn) {
        if(conn instanceof OracleConnection){
            OracleConnection oracleConnection = (OracleConnection)conn;
            try {
                if(oracleConnection.getImplicitCachingEnabled()) {
                    oracleConnection.purgeImplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
            try {
                if(oracleConnection.getExplicitCachingEnabled()) {
                    oracleConnection.purgeExplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
        }
View Full Code Here


     * INTERNAL:
     * Clears both implicit and explicit caches of OracleConnection
     */
    public void clearOracleConnectionCache(Connection conn) {
        if(conn instanceof OracleConnection){
            OracleConnection oracleConnection = (OracleConnection)conn;
            try {
                if(oracleConnection.getImplicitCachingEnabled()) {
                    oracleConnection.purgeImplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
            try {
                if(oracleConnection.getExplicitCachingEnabled()) {
                    oracleConnection.purgeExplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
        }
View Full Code Here

     * INTERNAL:
     * Clears both implicit and explicit caches of OracleConnection
     */
    public void clearOracleConnectionCache(Connection conn) {
        if(conn instanceof OracleConnection){
            OracleConnection oracleConnection = (OracleConnection)conn;
            try {
                if(oracleConnection.getImplicitCachingEnabled()) {
                    oracleConnection.purgeImplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
            try {
                if(oracleConnection.getExplicitCachingEnabled()) {
                    oracleConnection.purgeExplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
        }
View Full Code Here

     * INTERNAL:
     * Clears both implicit and explicit caches of OracleConnection
     */
    public void clearOracleConnectionCache(Connection conn) {
        if(conn instanceof OracleConnection){
            OracleConnection oracleConnection = (OracleConnection)conn;
            try {
                if(oracleConnection.getImplicitCachingEnabled()) {
                    oracleConnection.purgeImplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
            try {
                if(oracleConnection.getExplicitCachingEnabled()) {
                    oracleConnection.purgeExplicitCache();
                }
            } catch(SQLException ex) {
                // ignore
            }
        }
View Full Code Here

    public synchronized boolean getIsConnected() {
        return IsConnected;
    }

    public synchronized OracleConnection getConn() {
        OracleConnection oc = null;
        try {
            while (oc == null) {
                oc = (OracleConnection) ods.getConnection();
            }
        } catch (SQLException ex) {
View Full Code Here

        return SelObjectAccessed;
    }

    public void LoadObjects(OUser ou, OObjectType ot) {
        this.clear();
        OracleConnection conn = ou.getConn();
        Statement stmt = null;
        ResultSet rset = null;
        //Statement stmt_src = null;
        //ResultSet rset_src = null;
        try {
            if (conn.isClosed()) {
                new SQLException("Connection is closed.");
            }
            stmt = conn.createStatement();
            switch (SelObjectAccessed) {
                case User:
                    rset = stmt.executeQuery("select t.object_name, t.created, t.last_ddl_time, t.status, '' from user_objects t where t.object_type = '" + AllObjType.toString().replace('_', ' ') + "'");
                    break;
                case All:
                    rset = stmt.executeQuery("select t.object_name, t.created, t.last_ddl_time, t.status, t.owner from all_objects t where t.object_type = '" + AllObjType.toString().replace('_', ' ') + "'");
                    break;
                case DBA:
                    rset = stmt.executeQuery("select t.object_name, t.created, t.last_ddl_time, t.status, t.owner from dba_objects t where t.object_type = '" + AllObjType.toString().replace('_', ' ') + "'");
                    break;
            }
            while (rset.next()) {
                BaseClass bc = new BaseClass(rset.getString(5), rset.getString(1),
                        AllObjType, rset.getTimestamp(2), rset.getTimestamp(3), rset.getString(4), ParentPref, ou, ot);
                this.add(bc);
            /*stmt_src = conn.createStatement();
            switch (SelObjectAccessed) {
            case User:
            rset_src = stmt_src.executeQuery("select t.text from user_source t where t.name = '" + rset.getString(1) + "' and t.type = '" + AllObjType.toString().replace('_', ' ') + "' order by t.line asc");
            break;
            case All:
            rset_src = stmt_src.executeQuery("select t.text from all_source t where t.name = '" + rset.getString(1) + "' and t.owner = '" + rset.getString(5) + "' and t.type = '" + AllObjType.toString().replace('_', ' ') + "' order by t.line asc");
            break;
            case DBA:
            rset_src = stmt_src.executeQuery("select t.text from dba_source t where t.name = '" + rset.getString(1) + "' and t.owner = '" + rset.getString(5) + "' and t.type = '" + AllObjType.toString().replace('_', ' ') + "' order by t.line asc");
            break;
            }
            //StringBuffer sb = new StringBuffer();
            StringBuilder sb = new StringBuilder();
            while (rset_src.next()) {
            sb.append(rset_src.getString(1));
            }
            if (sb.length() > 0) {
            sb.insert(0, "create or replace ");
            //sb.append('/');
            bc.setObjectSource(sb.toString());
            }
            this.add(bc);
            rset_src.close();
            stmt_src.close();*/
            }
            if (conn != null) {
                conn.close();
            }
            //SourcesTry inst = SourcesTry.getInstance(this, ou.getOracleDataSource());
            //inst.post();
            LoadObjectSourcesThread los = new LoadObjectSourcesThread(this, ou.getConn());
            new Thread(los).start();

        } catch (SQLException ex) {
            if (ex.getErrorCode() != 942 && ex.getErrorCode() != 17008 && ex.getErrorCode() != 17011) {
                // 942 - because of dba views; 17008 - Connection Closed; 17011 - Exhausted Resultset               
                Exceptions.printStackTrace(ex);
            }
        } finally {
            try {

                /*if (rset_src != null) {
                rset_src.close();
                }
                if (stmt_src != null) {
                stmt_src.close();
                }*/
                if (rset != null) {
                    rset.close();
                }
                if (stmt != null) {
                    stmt.close();
                }
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
View Full Code Here

        }
        FileObject file;
        DataObject dob;
        try {
            FileWriter fw = new FileWriter(selFile);
            OracleConnection conn = ou.getConn();
            this.LoadObjectSource(conn);
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
            fw.write(this.ObjectSource);
View Full Code Here

    public void Compile() {
        new CompileInThread(this).post();
    }

    public void Delete() {
        OracleConnection conn = null;
        Statement stmt = null;
        if (ou.getIsConnected()) {
            try {
                conn = ou.getConn();
                stmt = conn.createStatement();
                ou.OutputMsg("", null, false);
                ou.OutputMsg(NbBundle.getMessage(Utils.getCommonClass(), "LBL_DroppingDB",
                        ObjectType.toString().replace('_', ' ').toLowerCase(), toString()), null, false);
                stmt.execute(BaseClass.getDropString(toString(), ObjectType));
                ou.OutputMsg(Utils.getBundle().getString("LBL_Done"), null, false);
                File f = new File(getLocalFile());
                if (f.exists()) {
                    try {
                        FileObject file = FileUtil.toFileObject(f);
                        DataObject dob = DataObject.find(file);
                        CloseCookie cookie = dob.getCookie(CloseCookie.class);
                        if (cookie != null) {
                            cookie.close();
                        }
                    } catch (IOException e) {
                        //Exceptions.printStackTrace(e);
                    }
                }

                try {
                    getPreferencesRoot().removeNode();
                } catch (BackingStoreException ex) {
                    Exceptions.printStackTrace(ex);
                }
                stmt.close();
                conn.close();
            } catch (SQLException ex) {
                while (ex != null) {
                    ou.OutputMsg(ex.getMessage(), null, true);
                    ex =
                            ex.getNextException();
                }

            } finally {
                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch (SQLException ex) {
                        Exceptions.printStackTrace(ex);
                    }
                }
                if (conn != null) {
                    try {
                        conn.close();
                    } catch (SQLException ex) {
                        Exceptions.printStackTrace(ex);
                    }
                }
            }
View Full Code Here

                public void run() {
                    File selFile = returnLocalFile();
                    FileObject file;
                    DataObject dob = null;
                    Statement stmt = null;
                    OracleConnection conn = null;
                    try {
                        file = FileUtil.toFileObject(selFile);
                        dob = DataObject.find(file);
                        SaveCookie cookie = dob.getCookie(SaveCookie.class);
                        if (cookie != null) {
                            cookie.save();
                        }
                    } catch (IOException ex) {
                        Exceptions.printStackTrace(ex);
                    }
                    if (ou.getIsConnected()) {
                        try {
                            FileReader fr = new FileReader(selFile);
                            BufferedReader br = new BufferedReader(fr);
                            StringBuilder sb = new StringBuilder();
                            String line = null;
                            while ((line = br.readLine()) != null) {
                                sb.append(line);
                                //sb.append(System.getProperty("line.separator"));
                                sb.append('\n');
                            }

                            br.close();
                            fr.close();

                            conn = ou.getConn();
                            stmt = conn.createStatement();
                            ou.OutputMsg("", null, false);
                            ou.OutputMsg(NbBundle.getMessage(Utils.getCommonClass(), "LBL_Compiling", getLocalFile()), null, false);
                            // Issue 10:  When character { and } is included in a string or comment compile fails 
                            stmt.setEscapeProcessing(false);
                            stmt.execute(sb.toString());
                            ou.OutputMsg(Utils.getBundle().getString("LBL_Done"), null, false);
                            ShowErrors(stmt, dob);

                            stmt.close();
                            conn.close();
                        } catch (SQLException ex) {
                            while (ex != null) {
                                ou.OutputMsg(ex.getMessage(), null, true);
                                ex = ex.getNextException();
                            }
View Full Code Here

    try
    {
      // Create a DriverManager.
      DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
      // Create a connection to the Oracle Database instance.
      OracleConnection o_connection =
      (OracleConnection)DriverManager.getConnection("jdbc:oracle:thin:@" +
         connection, user, password);

      // Get information from the olapsys.xml_load_log table.
      String result = null;
      String sqlText = "select distinct xml_loadid " +
                       "from olapsys.xml_load_log " +
                       "order by xml_loadid desc";
      Statement sqlStmt = o_connection.createStatement();
      ResultSet rs = sqlStmt.executeQuery(sqlText);
      if(rs.next())
      {
        // Get the first value.
        int loadid = rs.getInt(1);
View Full Code Here

TOP

Related Classes of oracle.jdbc.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.