Skip to content

Daschi1/JavaMySQLAPI

Repository files navigation

JavaMySQLAPI

A MySQL api for java.

Usage (For advice on how to create a sql query, look here)

MySQL.add(/*id*/, new MySQL(/*hostname*/, /*port*/, /*username*/, /*password*/, /*database*/)); //connect to a mySQL
MySQL.disconnect(/*id*/); //disconnects the mySQL
MySQL.using(/*id*/, /*autoDisconnect*/); //configure autoDisconnect when program terminates

CachedRowSet cachedRowSet = MySQl.query(/*id*/, /*sql*/); //execute a query an recieve an CachedRowSet
MySQL.update(/*id*/, /*sql*/); //execute an update

MySQL.preventSQLInjection(/*id*/, /*parameter*/); //prevents mySQLInjection by adding comments for all ' and `

MySQL mySQL = MySQL.getMySQL(/*id*/); //get mySQL for more options

If you don't like working with the static methods and the id system, you can also just save your own MySQL object.