'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 - Oracle connection - set date format
yii2 session timeout not working
set property authTimeout in user component
and set propety enableAutoLogin to false
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@';
## enable binlog
server_id=1
log_bin = /path/to/your/binlogfile.log
expire_logs_days = 10
max_binlog_size = 100M
binlog-format = row
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
Yii2 - Gii generators - how to custom crud templates
Yii2 - using kartik Select2 as filter input of GridView
'filter' => Select2::widget([ 'name' => 'CampaignSearch[partner_id]', 'model' => $searchModel, 'value' => $searchModel->partner_id, 'data' => ArrayHelper::map( Partner::getAll(), 'id', 'name' ), 'size' => Select2::MEDIUM, 'options' => [ 'placeholder' => '-- Tất cả --', 'style' => 'width: 300px;' ], 'pluginOptions' => [ 'allowClear' => true ], 'addon' => [ 'prepend' => [ 'content' => '<i class="glyphicon glyphicon-folder-open"></i>' ] ], ]),
Yii2 session timeout settings
Edit @yourApp/config/main.php
'components' => [
'user' => [
'identityClass' => 'backend\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_cmsIdentity',
'httpOnly' => true,
'expire' => 1800,
],
'authTimeout'=> 1800, // seconds
],
....
],
show table information
DESCRIBE table_name;
show Field from table_name;
SHOW INDEX FROM table_name;
show Field from table_name;
SHOW INDEX FROM table_name;
Subscribe to:
Posts (Atom)