Check Domain Name


JAVA codes for dbconnectivities for MYSQL

The following JAVA sample script Code allows you connect to MYSQL Database

In the code given below the Database is rds, Username is rdsindia
and Password is tryme.

Note : Users are requested to change the above said parameters with their respective
DSN, Username and Password.

//Start of code--mysql
import java.sql.* ;
import java.math.* ;
public class first
{
public static void main(String a[])
{
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
//System.setProperty("jdbc.drivers","org.gjt.mm.mysql.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/rds","rdsindia","tryme");
//rds--dbname,rdsindia--username,tryme--password
Statement smt = conn.createStatement() ;
smt.execute("create table test(no varchar(20))") ;
} catch (Exception e ) { System.out.println(e) ;}
System.out.println("db working fine");
}
}
//End of code

Visit Indian SEO for Search Engine Optimization Website
Maintenance Services Bangalore India
Visit indianattire.com for Indian attire
Copy Right 2001 - 2005 All Rights Reserved Terms and Conditions