Monday, June 22, 2009

MySQL Connection using Java

show databases; //display database name
create database database-name; //create database
use database-name; //use database
show tables from database-name; //show tables
show columns from table-name; //show colums
drop database database-name; //drop database

java syntax to connect to database

Connection con=DriverManager.getConnection("jdbc:mysql:///shop","root","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from item_master where category_name='"+cname+"' ");

here shop is db name of my jsp project

Author : Anuj Patel

Blog :

No comments:

Post a Comment