Package com.github.ambry.account.mysql
Class MySqlDataAccessor
- java.lang.Object
-
- com.github.ambry.account.mysql.MySqlDataAccessor
-
public class MySqlDataAccessor extends java.lang.Object
Data Accessor to connect to MySql database.
-
-
Constructor Summary
Constructors Constructor Description MySqlDataAccessor(MySqlUtils.DbEndpoint dbEndpoint)
Production constructorMySqlDataAccessor(MySqlUtils.DbEndpoint dbEndpoint, java.sql.Driver mysqlDriver)
Test constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.Connection
getDatabaseConnection()
java.sql.PreparedStatement
getPreparedStatement(java.lang.String sql)
-
-
-
Constructor Detail
-
MySqlDataAccessor
public MySqlDataAccessor(MySqlUtils.DbEndpoint dbEndpoint) throws java.sql.SQLException
Production constructor- Throws:
java.sql.SQLException
-
MySqlDataAccessor
public MySqlDataAccessor(MySqlUtils.DbEndpoint dbEndpoint, java.sql.Driver mysqlDriver)
Test constructor
-
-
Method Detail
-
getDatabaseConnection
public java.sql.Connection getDatabaseConnection() throws java.sql.SQLException
- Returns:
- a JDBC
Connection
to the database. An existing connection will be reused. - Throws:
java.sql.SQLException
-
getPreparedStatement
public java.sql.PreparedStatement getPreparedStatement(java.lang.String sql) throws java.sql.SQLException
- Parameters:
sql
- the SQL text to use.- Returns:
- a
PreparedStatement
using the supplied SQL text. - Throws:
java.sql.SQLException
-
-