Interface MySQLConnection
- All Superinterfaces:
SqlClient, SqlConnection
An interface which represents a connection to MySQL server.
The connection object supports all the operations defined in the SqlConnection interface,
in addition it provides MySQL utility command support:
- COM_PING
- COM_CHANGE_USER
- COM_RESET_CONNECTION
- COM_DEBUG
- COM_INIT_DB
- COM_STATISTICS
- COM_SET_OPTION
-
Method Summary
Modifier and TypeMethodDescriptionstatic MySQLConnectioncast(SqlConnection sqlConnection) Cast aSqlConnectiontoMySQLConnection.changeUser(MySQLAuthOptions options) Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.closeHandler(Handler<Void> handler) Set an handler called when the connection is closed.static Future<MySQLConnection> connect(Vertx vertx, MySQLConnectOptions connectOptions) Create a connection to MySQL server with the givenconnectOptions.static Future<MySQLConnection> Likeconnect(Vertx, MySQLConnectOptions)with options built fromconnectionUri.debug()Send a DEBUG command to dump debug information to the server's stdout.exceptionHandler(Handler<Throwable> handler) Set an handler called with connection errors.Send a STATISTICS command to get a human readable string of the server internal status.ping()Send a PING command to check if the server is alive.Send a RESET_CONNECTION command to reset the session state.setOption(MySQLSetOption option) Send a SET_OPTION command to set options for the current connection.specifySchema(String schemaName) Send a INIT_DB command to change the default schema of the connection.Methods inherited from interface SqlClient
close, preparedQuery, preparedQuery, queryMethods inherited from interface SqlConnection
begin, databaseMetadata, isSSL, prepare, prepare, transaction
-
Method Details
-
connect
Create a connection to MySQL server with the givenconnectOptions.- Parameters:
vertx- the vertx instanceconnectOptions- the options for the connection- Returns:
- a future notified with the connection or the failure
-
connect
Likeconnect(Vertx, MySQLConnectOptions)with options built fromconnectionUri. -
exceptionHandler
Set an handler called with connection errors.- Specified by:
exceptionHandlerin interfaceSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
Set an handler called when the connection is closed.- Specified by:
closeHandlerin interfaceSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
ping
-
specifySchema
-
getInternalStatistics
-
setOption
Send a SET_OPTION command to set options for the current connection.- Parameters:
option- the options to set- Returns:
- a future notified with the execution result
-
resetConnection
-
debug
-
changeUser
Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.- Returns:
- a future notified with the execution result
-
cast
Cast aSqlConnectiontoMySQLConnection. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-