17 Eylül 2021 Cuma
Oracle Clusterware Control - crsctl komutu
Açıklama yaz
Oracle Recovery Manager - RMAN
Açıklama yaz
11 Ağustos 2021 Çarşamba
Maven İle Oracle JDBC Thin Driver
JDBC Thin Driver vs OCI
Açıklaması şöyle. Yani Java kullanıyorsak JDBC Thin Driver yeterli.
Oracle provides four types of drivers for their database, but I'll only enumerate the two you asked about.The OCI driver is a type 2 JDBC driver and uses native code to connect to the database. Thus, it is only an option on platforms that have native Oracle drivers available and it is not a "pure" Java implementation.Oracle's JDBC Thin driver is a type 4 JDBC Driver that uses Java sockets to connect directly to Oracle. It implements Oracle's SQL*Net TCP/IP protocol directly. Because it is 100% Java, it is platform independent ...
Maven
ojdbc "Oracle JDBC Driver" anlamına gelir
ojdbc11
Örnek
Şöyle yaparız
<dependency> <groupId>com.oracle.database.jdbc</groupId> <artifactId>ojdbc11</artifactId> <version>23.2.0.0</version> </dependency>
ojdbc10
Örnek
Şöyle yaparız
Java 11<dependency><groupId>com.oracle.database.jdbc</groupId><artifactId>ojdbc10</artifactId><version>${oracle.version}</version></dependency>Java 8<dependency><groupId>com.oracle.database.jdbc</groupId><artifactId>ojdbc8</artifactId><version>${oracle.version}</version></dependency>Java 6<dependency><groupId>com.oracle.database.jdbc</groupId><artifactId>ojdbc6</artifactId><version>${oracle.version}</version></dependency>
ojdbc8
Java 8 içindir
Örnek
Şöyle yaparız
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc8</artifactId> <version>19.7.0.0</version> </dependency>
Şöyle yaparız
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8-production</artifactId>
<version>21.7.0.0</version>
<type>pom</type>
</dependency>ojdbc7
Java 8 öncesi içindir
Örnek
Şöyle yaparız.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>Sınıflar
Connection Pool
Oracle Universal Connection Pool kullanılabilir.
Universal Connection Pool - PoolDataSource Sınıfı yazısına bakabilirsiniz.
Universal Connection Pool - PoolDataSource Sınıfı
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();22 Mayıs 2020 Cuma
Oracle NoSQL Database
Giriş
Açıklaması şöyle.
Açıklaması şöyle.
It is worth nothing that the Oracle's flagship database and their NoSQL one are separate products.
9 Eylül 2019 Pazartesi
Java OracleCallableStatement Arayüzü
cosntructor
Şöyle yaparız.
Şöyle yaparız.
oracle.jdbc.OracleConnection connection = ...;
OracleCallableStatement callableStatement = (OracleCallableStatement) connection
.prepareCall("{call bss_acc.ACC_STATEMENT(?,?,?,?)}");
4 Eylül 2019 Çarşamba
TO_DATE Metodu
Giriş
İmzası şöyle. String parametre Date'e çevrilir. TO_CHAR metodu Date'i string'e çevirir.
Şöyle yaparız.
Şöyle yaparız.
Şöyle yaparız.
Ay isimleri NLS_DATE_LANGUAGE ve NLS_DATE_FORMAT ayarlarına bağlı. Çok güvenmemek lazım.
Örnek
Şöyle yaparız.
İmzası şöyle. String parametre Date'e çevrilir. TO_CHAR metodu Date'i string'e çevirir.
TO_DATE( date_string, format_model, nls_params )
Açıklaması şöyle.TO_DATE function just converts string to dateÖrnek
Şöyle yaparız.
TO_DATE ('10-AUG-2016')
Örnek
Elimizde '20190801' olsun. Sadece ay kısmını almak için şöyle yaparız.
ÖrnekElimizde '20190801' olsun. Sadece ay kısmını almak için şöyle yaparız.
select extract(month from to_date(ID_BB_SECURITY, 'YYYYMMDD')) from BT_EXPORT
MM - Ay NumarasıŞöyle yaparız.
select employee_id from employee
where employee_date_hired > to_date('31-12-1995','DD-MM-YYYY')
Ay numarası yerine ay ismi verilmez. Şu kod yanlış.select * from emp_tasks
where TASK_START_DATE > to_Date('30-MAR-18','DD-MM-YYYY');
ÖrnekŞöyle yaparız.
TO_DATE(PHOTO_ACCEPTENCE_DATE,'DD-MM-YY')
MON - Ay İsmiAy isimleri NLS_DATE_LANGUAGE ve NLS_DATE_FORMAT ayarlarına bağlı. Çok güvenmemek lazım.
Örnek
Şöyle yaparız.
select employee_id from employee
where employee_date_hired > to_date('31-DEC-95','DD-MON-YY')
Kaydol:
Kayıtlar (Atom)