public class MySQLConnect extends Object
Constructor and Description |
---|
MySQLConnect(String mysqlHost,
int mysqlPort,
String mysqlDB,
String mysqlUser,
String mysqlPW,
byte verifyServerCertificate,
byte useSSL,
byte requireSSL,
byte useCompression)
Load the MySQL driver and set all connection parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
connect() |
Connection |
getConnection() |
PreparedStatement |
getPreparedStatement(String sql) |
Statement |
getStatement() |
public MySQLConnect(String mysqlHost, int mysqlPort, String mysqlDB, String mysqlUser, String mysqlPW, byte verifyServerCertificate, byte useSSL, byte requireSSL, byte useCompression) throws ClassNotFoundException
mysqlHost
- MySQL hostnamemysqlPort
- MySQL portmysqlDB
- MySQL databasemysqlUser
- MySQL usernamemysqlPW
- MySQL passwordverifyServerCertificate
- Should the driver verify the server's certificate? -1 = use default, 0 = no, 1 = yesuseSSL
- Use SSL when communicating with the server? -1 = use default, 0 = no, 1 = yesrequireSSL
- Require server support of SSL connection if useSSL = 1. -1 = use default, 0 = no, 1 = yesuseCompression
- Use zlib compression when communicating with the server? -1 = use default, 0 = no, 1 = yesClassNotFoundException
- If the MySQL driver was not found.public void close()
public void connect() throws SQLException
SQLException
public Connection getConnection()
public PreparedStatement getPreparedStatement(String sql) throws SQLException
SQLException
public Statement getStatement() throws SQLException
SQLException