PHP like MySQL programming for Java
This version is out of date. Please see the latest version: Simple MySQL Library for Java
About
Java is a powerfull langauge, but sometimes the simplest things can be duanting, like MySQL. Introducing a simplier way, a PHP like MySQL library for Java. With this library, you can create simple database applications using similiar functions and methods to PHP.
Requirements
You will need the MySQL JDBC Driver in order to use this. This is included with Netbeans 6.0
How to use (Example)
In Netbeans 6.0 add the SimpleMySQL Jar to your projects Library files.
import java.sql.*;
import simplemysql.SimpleMySQL;
//Initialize
SimpleMySQL mysql;
mysql = new SimpleMySQL();
//Connect to the Database
mysql.connect("mysql.example.com", "db_user", "db_password");
//Do a SELECT Query
ResultSet result;
result = mysql.query ("SELECT * FROM myTable");
//Print all of the Results
try{
while (result.next()){
System.out.print_ln((result.getString("name"));
}
result.close();
}
catch(Exception x) {
x.printStackTrace();
}
//Do an INSERT query
mysql.query ("INSERT INTO myTable (name) VALUES("MyName")");
mysql.close();
Where to get it
Download the JAR: http://www.unibia.com/unibia/dev/downloads/SimpleMySQL.jar.tar
Download the Source: http://www.unibia.com/unibia/dev/downloads/SimpleMySQL.java
Download the Netbeans Project Files: http://www.unibia.com/unibia/dev/downloads/SimpleMySQL.tar
- Log in to post comments