Package org.apache.spark.sql.jdbc
Class JdbcConnectionProvider
Object
org.apache.spark.sql.jdbc.JdbcConnectionProvider
::DeveloperApi::
 Connection provider which opens connection toward various databases (database specific instance
 needed). If any authentication required then it's the provider's responsibility to set all
 the parameters.
 Important to mention connection providers within a JVM used from multiple threads so adding
 internal state is not advised. If any state added then it must be synchronized properly.
 
- Since:
- 3.1.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract booleanChecks if this connection provider instance can handle the connection initiated by the driver.abstract ConnectiongetConnection(Driver driver, scala.collection.immutable.Map<String, String> options) Opens connection to the database.abstract booleanmodifiesSecurityContext(Driver driver, scala.collection.immutable.Map<String, String> options) Checks if this connection provider instance needs to modify global security configuration to handle authentication and thus should synchronize access to the security configuration while the given driver is initiating a connection with the given options.abstract Stringname()Name of the service to provide JDBC connections.
- 
Constructor Details- 
JdbcConnectionProviderpublic JdbcConnectionProvider()
 
- 
- 
Method Details- 
canHandlepublic abstract boolean canHandle(Driver driver, scala.collection.immutable.Map<String, String> options) Checks if this connection provider instance can handle the connection initiated by the driver. There must be exactly one active connection provider which can handle the connection for a specific driver. If this requirement doesn't met thenIllegalArgumentExceptionwill be thrown by the provider framework.- Parameters:
- driver- Java driver which initiates the connection
- options- Driver options which initiates the connection
- Returns:
- True if the connection provider can handle the driver with the given options.
 
- 
getConnectionpublic abstract Connection getConnection(Driver driver, scala.collection.immutable.Map<String, String> options) Opens connection to the database. Since global JVM security configuration change may be needed this API is called synchronized bySecurityConfigurationLockto avoid race whenmodifiesSecurityContextreturns true for the given driver with the given options.- Parameters:
- driver- Java driver which initiates the connection
- options- Driver options which initiates the connection
- Returns:
- a Connectionobject that represents a connection to the URL
 
- 
modifiesSecurityContextpublic abstract boolean modifiesSecurityContext(Driver driver, scala.collection.immutable.Map<String, String> options) Checks if this connection provider instance needs to modify global security configuration to handle authentication and thus should synchronize access to the security configuration while the given driver is initiating a connection with the given options.- Parameters:
- driver- Java driver which initiates the connection
- options- Driver options which initiates the connection
- Returns:
- True if the connection provider will need to modify the security configuration when initiating a connection with the given driver with the given options.
- Since:
- 3.1.3
 
- 
nameName of the service to provide JDBC connections. This name should be unique. Spark will internally use this name to differentiate JDBC connection providers.- Returns:
- (undocumented)
 
 
-