Posts

Showing posts from February, 2020

Top most used GIT commands

Checkout GIT repository in current folder git clone <repository name> . Checkout GIT repository in current folder git checkout -b <new branch name> Push new branch changes to remote repository git push origin  <new branch name> Cherry pick code git cherry-pick <Commit hash string> list all the un-tracked files git clean -n Remove all the un-tracked files git clean -f Remove all the un-tracked files and directories git clean -f -d Delete branch git branch -d <branch Name>              /* local branch */ git branch -D <branch Name>               /* for delete local + remote branch */ Applying stash git stash apply <Stash with index> List all Stash available git stash list Abort merge in progress, this reverts all the files from abort git merge --abort Abort cherry pick that is in progress git cherry-pick --abort Checkout main branch gi...

Most common MySQL or MariaDB commands for Web Developers

Create Database    create database <Database Name>; Selecting a Database   Use <Database Name>; List all tables in Database   show tables; Create User table CREATE TABLE USER ( ID int NOT NULL, NAME varchar(100) NOT NULL, EMAIL_ADDRESS varchar(100), PRIMARY KEY (ID) ) Or  CREATE TABLE USER ( ID int NOT NULL AUTO_INCREMENT, NAME varchar(100) NOT NULL, EMAIL_ADDRESS varchar(100) NOT NULL, SALARY double DEFAULT NULL, NOTE text, PRIMARY KEY (ID) )

Connecting MariaDB using JDBC

Assumption :      You have MariaDB and Client installed. Steps:      Run client and create database using command "create database".       create database test;      Now, connect to that database using "USE" command       Use test;      Create new table USER with following command       CREATE TABLE USER (       ID int NOT NULL,       NAME varchar(100) NOT NULL,       EMAIL_ADDRESS varchar(100),       PRIMARY KEY (ID)       )      Now, download the driver from mysql site. I'm using "mysql-connector-java-5.1.46". MySql and MariaDB are similar so for basic connectivity mysql drivers works. Class.forName("com.mysql.jdbc.Driver"); java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "password"); Prepare...