Category: Database
What is PDO? Why PDO should be used in PHP?
PDO stands for PHP Data Objects. PDO is a consistent way to access databases. Today, mostly websites or desktop based applications store their data in databases. Therefore, PHP has also provided the way to connect with databases. PHP supports following
Timestamp issue while upgrading to MySQL 5.7
Problem: In our application, we have created the session token to provide secure access. We were using current system time stamp in our token as one of the key component. But after upgrading MySQL 5.5 to MySQL 5.7, we were
Postgresql | How to save default timestamp in unix format instead of yyyy-dd-mm hh:mm:ss
In Postgresql we can save the default timestamp with now() method: CREATE TABLE test ( id serial NOT NULL, name character varying(255), last_modified_time timestamp without time zone DEFAULT now() ) This will save the date timestamp in this format: If
MySQL | Enable/Disable Auto Commit
How to enable or disable autocommit of changes in MySQL using MySQL workbench? Go to Edit->Preferences->SQL Editor->SQL Execution and check your current settings: Also commit/rollback can be done with the buttons on SQL tab:
AWS | Upgrading mysql version
AWS: Upgrading MySQL version Below are few step to upgrade Mysql version very easily on AWS-RDS: 1. Log on to AWS console. 2. Open AWS RDS from Database section: 3. Click on Instances: 4. Select the Database Instance which you
Taking Database Backup And Moving that backup from one server to another using PHP
While working on two servers, we can take the backup of database on one server using mysqldump command in php. Example : exec(‘mysqldump –host ‘.$dbhost.’ –user ‘.$dbuser.’ –password=’.$dbpass.” “. $dbname.’ > ‘.$dbname.’.sql’); After creating dump of database, user can move
Scaffolding in CakePHP
Scaffolding in CakePHP Application scaffolding in CakePHP is a technique that allows the developer to define and create a basic application that can create, retrieve, update and delete objects. Basically CRUD (create, Read, Update, Delete) data operations are common in
Postgresql | Querying over local and remote database together
You can create a dblink to a remote database in postgresql and query both local and remote together. Steps and an example below: 1. Enable dblink in postgresql CREATE EXTENSION dblink; 2. Create connection with database server SELECT dblink_connect(‘dbname=abc port=1234
Java | Hibernate best practices
1. Always define hashCode() and equals() methods in your Persistent classes. 2. Persistent class method’s equals() and hashCode() must access its fields through getter methods. It is a good practice to use accessor methods instead of direct instance variable access.
