import java.sql.*;
import java.io.*;
publicstaticvoid main(String[] args) {
// TODO Auto-generated method stub
ex = ex.getNextException();
publicstaticvoid runTest()
throws SQLException, IOException
Connection conn = getConnection();
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE Greetings(Message CHAR(20))");
stat.execute("INSERT INTO Greeting VALUES('Hello World!')");
ResultSet result = stat.executeQuery("SELECT * FROM Greetings");
System.out.println(result.getString(1));
stat.execute("DROP TABLE Greetings");
publicstatic Connection getConnection()
throws SQLException, IOException
Properties props = new Properties();
FileInputStream in = new FileInputStream("database.properties");
String drivers = props.getProperty("jdbc.drivers");
System.setProperty("jdbc", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return DriverManager.getConnection(url, username, password);