The blog gives you idea of testing and automation testing example of selenium webdriver,SQl and Jmeter, you see the basic example of selenium web driver and get idea how to do automation testing,

Connection String for MYSQL and MSSQL database, In hibernate file

Mysql and Mssql Database is Different and structure is also different, if you want to connect the mysql and mssql DB with you application through hibernate then you have to enter below code in your hibernate file

both database have diffferent port number and different dialect if you enter replace mysql dialect  with mssql dialect then your code do not run

MySql:

MSsql:

if Database in your local system then you can write 127.0.0.1 or localhost with port number,
but if Database in other machine and that machine with in the Network then you have enter ipaddress of that machine with port number


How to open in MySql through Command prompt in windows system

Mysql is a Database and it is open source( free for all), Generally Mysql is on linux machine but you can also install & access Mysql in windows system.
MySQL is a popular choice of database for use in web applications, syntax of Mysql and Mssql is little bit different but nows a days use of Mysql is more because it is free.

For windows system you have to install mysql in your machine, once it install successfully the open CMD in your system. before this you have to start he mysql services in your system or if you have Wamp server in your system then you have to start the wamp server

C:\> 
Go to location where mysql is install Eg : C:\wamp\bin\mysql\mysql5.5.24\bin>
C:\> cd wamp\bin\mysql\mysql5.5.24\bin
C:\wamp\bin\mysql\mysql5.5.24\bin>
Enter the below Command in cmd then press enter key
mysql -u root -p

In above u stands for username and p stands for password, in my machine i have root user that I enter root you can enter other username also

C:\wamp\bin\mysql\mysql5.5.24\bin> mysql -u root -p



after if you write show Databases; command then it show you all database restore in the machine or list of database
mysql> SHOW DATABASES;
If you want to exit for the mysql then you have to write below command
mysql> exit



Swap Of two Variable without use of Third Variable

Swapping of Two variable with out using third variable, this question is asked so many times in interview,

Concept and login behind this is very simple

1) Take two variable and assign value to them
2) Add value of both variable
3) Minus value of one variable from above added variable value

Below is the code of swap variable -:

public class swap {

static int x =10;
static int y= 20;

public static void main(String[] args)
          {

System.out.println("Value of X Before swap :-" + x );

System.out.println("Value of Y Before swap :-" + y );
x=x+y;
-- Swapping of variable logic
y=x-y;
x=x-y;

System.out.println("Value of X after swap :" + x );

System.out.println("Value of Y after swap :" + y );

}


                         }


OUTPUT :

X=20
Y=10

How to merge data of two column into Single one in SQL ?

In SQL if you have one table which More than two Fields and if you want to merge data of Two or More then two fields then follow the below steps.

Select  column name from  table name
Union
select column name 1 from table name




Select Lastname from employee
union
select Username from employee

Data after execution of above query


above table show concatenation of column in to one, I take lastname and username column and merge into a single column which is show above.



Powered by Blogger.