Monday, March 26, 2012

adding user to mysql on the command line

login to admin as root
go to start-->cmd prompt, type following command
c:>mysql - u root - p           (it will ask for the password)
Enter the password:****     (give the passworg which is generally root)

now you will inter into mysql command line interface

mysql> create user 'newuser'@'localhost';     (it will create you a new user which is myuser)

mysql> set password for 'newuser'@'localhost' =PASSWORD('myuser');
                                                                    (it will set the password for myser as myuser)

you can again login to the mysql with the create user as
 c:>mysql  -u newuser -p
Enter password:newuser 

Saturday, March 24, 2012

Hibernate Tutorial For Beginners

Open eclipse framework,
File-->New-->Other-->Java Project-->Give name of the project-->Finish

Go to http://www.hibernate.org/downloads download the release bundles save it.  
Right click the created project-->propertires-->java Bulid path-->Add Library-->user library-->Next-->user libraries-->New-->User Library Name-->Give name HibernateLib-->Ok

Select Created library that is HibernateLib-->Add jars.
1) hibernate3.jar
2) All jars in requireed folder.
3) hibernate-jpa-2.0 from lib/jpa folder
4) javassist-3.12.0.GA from lib/bytecode/javaassist folder
5) one extra jar which you can add externally ,drivers i.e mysql connector.
total 9 jars are ther have a look.

Right click the created project-->propertires-->java Bulid path-->Add Library-->user library-->Next-->choose the create HibernateLib-->select it-->finish.

You are all set to go.
Your Hibernate enviornment is all set

Next tutorial we will have our first hibernate program.
(next tutorial if you want,so give your feedback...thank you)















java-8-streams-map-examples

package com.mkyong.java8; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; im...