import java.sql.*;
public class Query1 {
public static void main(String[] args) {
String url = "jdbc:mysql://demo.c25xakasledb.us-west-2.rds.amazonaws.com:3307/demo";
String user = "zzzzz";
String password = "xxxxx";
try {
// 1. Get a connection to the database
Connection connection = DriverManager
.getConnection(
"jdbc:mysql://demo.c25xakasledb.us-west-2.rds.amazonaws.com:3307/demo",
"zzzz", "xxxxx");
// 2. Create statement
Statement statement = connection.createStatement();
// 3. Execute a sql query
// ResultSet
// resultset=statement.executeQuery("select * from PERSON");
String sql = "insert into PERSON"
+ "(FName, Minit, LName, SSN, B_date, Address, County, Sex, Phone,Type_id,Username,Password, Email)"
+ "values"
+ "('Ellen','G','White','115-77-1375','1897-03-31','107 First Street grafton nd 58216',"
+ "'Polk', 'F','(347)234-3513',3,'',egwhite','egwhite@yahoo.com')";
statement.executeUpdate(sql);
System.out.println("Insert complete");
/*
* //4. Process result while(resultset.next()){
* System.out.println(resultset
* .getString("FName")+","+resultset.getString("LName")+
* ","+resultset
* .getString("SSN")+","+resultset.getString("B_date")+","+
* resultset
* .getString("County")+","+resultset.getString("Sex")+","+resultset
* .getString("Phone")); }
*/
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
}