Giriş
Açıklaması şöyle. Yani 12c'den sonra JDBC sürücüsü de en az 12.1.0.2 olmalı
Prior to 12c (i.e., 12.1.0.1.0), UCP could work with any version of Oracle JDBC driver. With the new pool, UCP 12.1.0.2, it is dependent on Oracle JDBC driver 12.1.0.2.
Örnek
Şöyle yaparız. OracleDataSource sınıfını kullanıyor
Örnekimport oracle.ucp.jdbc.PoolDataSource;import java.sql.Connection;import java.sql.SQLException;PoolDataSource ds = PoolDataSourceFactory.getPoolDataSource();ds.setUser("...");ds.setPassword("...");ds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");ds.setURL("jdbc:oracle:thin:@exampledb?TNS_ADMIN=/msdataworkshop/creds");Connecton con = ds.getConnection();
Şöyle yaparız.
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setURL(...);
pds.setUser(...);
pds.setPassword(...);
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
//Setting pool properties
pds.setInitialPoolSize(5);
pds.setMinPoolSize(5);
pds.setMaxPoolSize(20);
Connection conn = pds.getConnection();
Şöyle yaparız.int usedConnectionCount = pds.getBorrowedConnectionsCount();
int availableConnectionCotun = pds.getAvailableConnectionsCount();
Hiç yorum yok:
Yorum Gönder