Package org.mybatis.generator.internal
Class JDBCConnectionFactory
java.lang.Object
org.mybatis.generator.internal.JDBCConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
This class assumes that classes are cached elsewhere for performance reasons,
but also to make sure that any native libraries are only loaded one time.
This avoids the dreaded UnsatisfiedLinkError library loaded in another
classloader.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Stringprivate Propertiesprivate Stringprivate String -
Constructor Summary
ConstructorsConstructorDescriptionThis constructor is called when this connection factory is specified as the type in a ConnectionFactory configuration element.This constructor is called when there is a JDBCConnectionConfiguration specified in the configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigurationProperties(Properties properties) Adds properties for this instance from any properties configured in the ConnectionFactory.Should return a connection to the database in use for this context.private Driver
-
Field Details
-
userId
-
password
-
connectionURL
-
driverClass
-
otherProperties
-
-
Constructor Details
-
JDBCConnectionFactory
This constructor is called when there is a JDBCConnectionConfiguration specified in the configuration.- Parameters:
config- the configuration
-
JDBCConnectionFactory
public JDBCConnectionFactory()This constructor is called when this connection factory is specified as the type in a ConnectionFactory configuration element.
-
-
Method Details
-
getConnection
Description copied from interface:ConnectionFactoryShould return a connection to the database in use for this context. The generator will call this method only one time for each context. The generator will close the connection.- Specified by:
getConnectionin interfaceConnectionFactory- Returns:
- the connection
- Throws:
SQLException- if there is some error obtaining the connection
-
getDriver
-
addConfigurationProperties
Description copied from interface:ConnectionFactoryAdds properties for this instance from any properties configured in the ConnectionFactory.This method will be called before any of the get methods.
- Specified by:
addConfigurationPropertiesin interfaceConnectionFactory- Parameters:
properties- All properties from the configuration
-