Home | About Us | Services | Recent Work | Website Hosting | Buy Domain | Contact Us | Tech-Support


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 indianseo 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","indianseo","tryme");
//rds--dbname,indianseo--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

 
Copyright © 2005-2007. Indian SEO All rights reserved.