Examples of OracleDataSource


Examples of oracle.jdbc.pool.OracleDataSource

    public DataSourceInfo getInfo(Object resource) throws Exception {
        DataSourceInfo dataSourceInfo = null;

        if (canMap(resource)) {
            OracleDataSource source = (OracleDataSource) resource;
            OracleConnectionCacheManager occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance();
            Properties cacheProperties = source.getConnectionCacheProperties();
            String cacheName = source.getConnectionCacheName();
            cacheName = cacheName != null && occm.existsCache(cacheName) ? cacheName : null;

            if (cacheProperties != null) {

                dataSourceInfo = new DataSourceInfo();
                if (cacheName != null) {
                    dataSourceInfo.setBusyConnections(occm.getNumberOfActiveConnections(cacheName));
                    dataSourceInfo.setEstablishedConnections(occm.getNumberOfAvailableConnections(cacheName) + dataSourceInfo.getBusyConnections());
                } else {
                    dataSourceInfo.setBusyConnections(0);
                    dataSourceInfo.setEstablishedConnections(0);
                }

                dataSourceInfo.setMaxConnections(Utils.toInt(cacheProperties.getProperty("MaxLimit"), -1));
                dataSourceInfo.setJdbcURL(source.getURL());
                dataSourceInfo.setUsername(source.getUser());
                dataSourceInfo.setResettable(true);
            }
        }
        return dataSourceInfo;
    }
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

    public static DataSource getSQLDataSource(String serverName,
            String dbInstance, int portNo, String driverName)
            throws SQLException {

        OracleDataSource ds = new OracleDataSource();
        ds.setDatabaseName(dbInstance);
        ds.setDriverType(driverName);
        ds.setServerName(serverName);
        ds.setPortNumber(portNo);
        ds.setNetworkProtocol("tcp");
        return (DataSource) ds;

    }
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

    public static DataSource getSQLDataSource(String serverName,
            String dbInstance, int portNo, String driverName,
            String username, String password)
            throws SQLException {

        OracleDataSource ds = new OracleDataSource();
        ds.setDatabaseName(dbInstance);
        ds.setDriverType(driverName);
        ds.setServerName(serverName);
        ds.setPortNumber(portNo);
        ds.setNetworkProtocol("tcp");
        ds.setUser(username);
        ds.setPassword(password);
        return ds;
    }
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

        return ds;
    }

    public static DataSource getSQLDataSource(final String url, final String username, final String password)throws SQLException {

        OracleDataSource ds = new OracleDataSource();
        ds.setURL(url);
        ds.setUser(username);
        ds.setPassword(password);
        return ds;
    }
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

        return getUserName();
    }

    public OracleDataSource getOracleDataSource() throws SQLException {
        if (ods == null) {
            ods = new OracleDataSource();
            ods.setDriverType("thin");
            ods.setServerName(Parent.getServerName());
            ods.setNetworkProtocol("tcp");
            if (Parent.getConnectionType() == ConnectionTypes.SID) {
                ods.setDatabaseName(Parent.getDatabaseName());
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

                public void run() {
                    try {
                        connecting = true;
                        boolean connect = true;
                        OracleDataSource ods = getOracleDataSource();
                        if (!getSavePassword()) {
                            PasswordJPanel pjp = new PasswordJPanel();
                            pjp.ShowDialog(getUserName());
                            connect =
                                    pjp.getisOK();
                            if (connect) {
                                ods.setPassword(pjp.getPassword());
                            }

                        }
                        if (connect) {
                            String localmsg = NbBundle.getMessage(Utils.getCommonClass(), "LBL_ConnectingToAs", Parent.toString(), UserName);
                            startProgress(localmsg);

                            ods.setConnectionCachingEnabled(true);
                            java.util.Properties props = ods.getConnectionProperties() == null ? new java.util.Properties() : ods.getConnectionProperties();
                            props.put(OracleConnection.CONNECTION_PROPERTY_THIN_VSESSION_PROGRAM, "PL/SQL Editor for NetBeans");
                            ods.setConnectionProperties(props);

                            java.util.Properties props_cache = new java.util.Properties();
                            props_cache.setProperty("MaxLimit", "2");
                            ods.setConnectionCacheProperties(props_cache);

                            OutputMsg(localmsg, null, false);
                            conn =
                                    (OracleConnection) ods.getConnection();
                            if (conn != null && !conn.isClosed()) {
                                setIsConnected(true);
                                OutputMsg(NbBundle.getMessage(Utils.getCommonClass(), "LBL_ConnectedAs", UserName), null, false);
                                EnableHints();
                                notifyChange();
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

   */
  private void _connect() {
    showInfo("Setting up connection properties...");

    try {
      OracleDataSource bds = (OracleDataSource) StorageService.ctx
          .getBean("olapdatasource");
      Connection connection = bds.getConnection();
      conn = (OracleConnection) connection;
      showInfo("Connection made.");
     
      _user = bds.getUser();
      _server = bds.getServerName();
     
    } catch (SQLException e) {
      e.printStackTrace();
    }

View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

  private void _connect()
  {
    showInfo("Setting up connection properties...");

    try {
      OracleDataSource bds = (OracleDataSource) StorageService.ctx
          .getBean("olapdatasource");
      Connection connection = bds.getConnection();
      conn = (OracleConnection) connection;
      showInfo("Connection made.");
     
      _user = bds.getUser();
      _server = bds.getServerName();
     
    } catch (SQLException e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

  }
 
  public boolean openConnection() throws DatabaseConnectionException{
    super.openConnection();
    //set the data source
    OracleDataSource dataSource = null;
    try{
      dataSource = new OracleDataSource();
      dataSource.setDriverType(driver);
      dataSource.setServerName(getUrl());
      dataSource.setPortNumber(port);
      dataSource.setDatabaseName(databaseName);
      dataSource.setUser(getUsername());
      dataSource.setPassword(password);
     
      //get the connection
      connection = (oracle.jdbc.driver.OracleConnection) dataSource.getConnection();
    }
    catch(SQLException e){
      e.printStackTrace();
    }
   
View Full Code Here

Examples of oracle.jdbc.pool.OracleDataSource

     * @param params
     * @return
     * @throws SQLException
     */
    protected DataSource connect( String user, String password, String url, Properties params ) throws SQLException{
        OracleDataSource source = new OracleDataSource();

        source.setUser( user );
        source.setPassword( password );
        source.setURL( url );
        //source.setConnectionProperties( params ); //not available in dummy jar
        return source;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.