Class SQLDBConfig
java.lang.Object
org.tribuo.data.sql.SQLDBConfig
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
public class SQLDBConfig
extends Object
implements com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
N.B. This class accepts raw SQL strings and executes them directly via JDBC. It DOES NOT perform
any SQL escaping or other injection prevention. It is the user's responsibility to ensure that SQL passed to this
class performs as desired.
SQL database configuration. If you specify the host, port, and
db strings and use
oracle.jdbc.OracleDriver as your JDBC Driver, then this will
automatically generate a connectionString, otherwise it must be specified manually and host, port, and db fields
can be omitted.
DriverManager's default logic will be used to determine which Driver to use for
a given connection string.-
Constructor Summary
ConstructorsConstructorDescriptionSQLDBConfig(String host, String port, String db, String username, String password, Map<String, String> properties) SQLDBConfig(String connectionString, String username, String password, Map<String, String> properties) SQLDBConfig(String connectionString, Map<String, String> properties) -
Method Summary
Modifier and TypeMethodDescriptionConstructs a connection based on the object fields.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenanceConstructs a statement based on the object fields.voidUsed by the OLCUT configuration system, and should not be called by external code.toString()
-
Constructor Details
-
SQLDBConfig
-
SQLDBConfig
-
SQLDBConfig
-
-
Method Details
-
postConfig
Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
getConnection
Constructs a connection based on the object fields.- Returns:
- A connection to the database.
- Throws:
SQLException- If the connection failed.
-
getStatement
Constructs a statement based on the object fields. Uses fetchSize to determine fetch size and sets defaults for querying data.- Returns:
- A statement object for querying the database.
- Throws:
SQLException- If the connection failed.
-
toString
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-