MySQL in Java made easy, a java API inspired by the way PHP handles mysql.
You just need one .jar file, it includes the drivers needed to run MYSQL in java.
Download latest version
Connects to the database at the host "localhost" with the username "root" and no password.
Mysql testMysql = new Mysql("localhost", "root", "");Gets the results from a basic SELECT query
ResultSet result = testMysql.query("SELECT * FROM database.table");Lists out all the usernames for the table
try {
while(result.next())
System.out.println(result.getString("username"));
} catch (SQLException e) {
e.printStackTrace();
}Inserts into the table a username and a password, with the username john and password 1234
testMysql.query("INSERT INTO database.table (username, password) VALUES ('john', '1234')");Updates the table, sets the username for row 1 to bob
testMysql.query("UPDATE database.table SET username='bob' WHERE id = 1");| id | username | password |
| 1 | bob | 1234 |
| 2 | john | 1234 |
| 3 | john | 1234 |
- Download the .jar from here.
- Add the .jar to your buildpath, see the wiki on how to do that.
- here you can see an example file to help or test if it works.
- You can find the javadoc here Javadoc