Yii2 - Oracle connection - set date format





        'db' => [
            'class' => 'apaoww\oci8\Oci8DbConnection',
            'dsn' => 'oci8:dbname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XXX)));charset=UTF8;', // Oracle
            'username' => 'xx',
            'password' => 'xxx#',
            'attributes' => [
                PDO::ATTR_STRINGIFY_FETCHES => true,
            ],
            'enableSchemaCache' => true,
            // Duration of schema cache.
            'schemaCacheDuration' => 3600,
            // Name of the cache component used to store schema information
            'schemaCache' => 'cache',
            'on afterOpen' => function ($event) {
                $event->sender->createCommand("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'")->execute();
            }
        ],

yii2 session timeout not working

set property authTimeout in user component

and set propety enableAutoLogin to false
'user' => [
        'identityClass'   => 'common\models\User',
        'enableAutoLogin' => false,
        'authTimeout'     => 20
],

java - mysql binlog reader from remote server

1. Configure your server to enable binlog in my.cnf file. The bold configurations are required.

## enable binlog
server_id=1
log_bin = /path/to/your/binlogfile.log
expire_logs_days = 10
max_binlog_size = 100M
binlog-format = row

2. Grant REPLICATION SLAVE, REPLICATION CLIENT privileges to user to read binlog from remote server
Login mysql with root user, then run command below:

GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'binloguser'@'%' IDENTIFIED BY '123456a@';

3. Test binlog reading from a remote server 

mysqlbinlog -R -h192.168.146.252 --port=3307 -ubinloguser -p mysql-bin.000001

Note: 
-R option instructs mysqlbinlog command to read the log file from the remote server
-h specify the ip-address of the remote server
-p This will prompt you for the password. 
mysqld-bin.000001 This is the name of the binary log file from the remote server that we are reading here

4. Read binlog with Java 
https://github.com/shyiko/mysql-binlog-connector-java