Package nzilbb.sql.mysql
Class MySQLConnectionFactory
- java.lang.Object
-
- nzilbb.sql.mysql.MySQLConnectionFactory
-
- All Implemented Interfaces:
ConnectionFactory
public class MySQLConnectionFactory extends Object implements ConnectionFactory
A factory for supplying connections to MySQL databases.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description MySQLConnectionFactory(String connectionUrl, String connectionName, String connectionPassword)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getConnectionName()
Getter forconnectionName
: Database user ID.String
getConnectionPassword()
Getter forconnectionPassword
: Database password.String
getConnectionUrl()
Getter forconnectionUrl
: Connection URL.Connection
newConnection()
Creates a new database connection.MySQLTranslator
newSQLTranslator()
Constructs an SQL translator appropriate for the type of connection made bynewConnection()
.MySQLConnectionFactory
setConnectionName(String newConnectionName)
Setter forconnectionName
: Database user ID.MySQLConnectionFactory
setConnectionPassword(String newConnectionPassword)
Setter forconnectionPassword
: Database password.MySQLConnectionFactory
setConnectionUrl(String newConnectionUrl)
Setter forconnectionUrl
: Connection URL.
-
-
-
Method Detail
-
getConnectionUrl
public String getConnectionUrl()
Getter forconnectionUrl
: Connection URL.- Returns:
- Connection URL.
-
setConnectionUrl
public MySQLConnectionFactory setConnectionUrl(String newConnectionUrl)
Setter forconnectionUrl
: Connection URL.- Parameters:
newConnectionUrl
- Connection URL.
-
getConnectionName
public String getConnectionName()
Getter forconnectionName
: Database user ID.- Returns:
- Database user ID.
-
setConnectionName
public MySQLConnectionFactory setConnectionName(String newConnectionName)
Setter forconnectionName
: Database user ID.- Parameters:
newConnectionName
- Database user ID.
-
getConnectionPassword
public String getConnectionPassword()
Getter forconnectionPassword
: Database password.- Returns:
- Database password.
-
setConnectionPassword
public MySQLConnectionFactory setConnectionPassword(String newConnectionPassword)
Setter forconnectionPassword
: Database password.- Parameters:
newConnectionPassword
- Database password.
-
newConnection
public Connection newConnection() throws SQLException
Creates a new database connection.- Specified by:
newConnection
in interfaceConnectionFactory
- Returns:
- A connected database connection.
- Throws:
SQLException
- If there's a problem connecting to the database.
-
newSQLTranslator
public MySQLTranslator newSQLTranslator()
Constructs an SQL translator appropriate for the type of connection made bynewConnection()
.- Specified by:
newSQLTranslator
in interfaceConnectionFactory
- Returns:
- An SQL translator.
-
-