Export To a JDBC-Compatible Database

DESCRIPTION:

Exports data to a database using JDBC drivers.

USAGE:

exportJDBC(data, table, appendToTable = TRUE, driverClass, con, user, password, 
           keepAlive = FALSE, preserveColumnCase = FALSE)

ARGUMENTS:

data
A data.frame or bdFrame to export.
table
The name of the database table.
appendToTable
If TRUE (the default), rows are appended to the existing table; otherwise, any existing table is dropped and an empty table is created prior to exporting the data.
driverClass
The name of the Java class for the required JDBC driver.
con
A JDBC connection string.
user
The user name with access to database.
password
The password for the given user name on the database.
keepAlive
If TRUE, keeps the database connection alive after executing the query. The default is FALSE.
preserveColumnCase
If TRUE, preserves case-sensitive column names, if supported by database. If FALSE (the default), column name case is converted to the database-specific default.

DETAILS:

Exports data to the database using the JDBC driver specified in driverClass. The necessary JDBC driver must be loaded in sjdbc before use. See for details.

Database connections are closed by default after the query executes, unless keepAlive is set to TRUE. If keepAlive = TRUE, the connection remains open, and successive database commands can reuse the open connection if and only if the same values for driverClass, con, user, and password are supplied.

VALUE:

The number of rows exported.

NOTE:

Some arguments can also be set using .

When exporting to a new table ( appendToTable=FALSE), column types of the resulting table may not be as desired. Columns containing text data will be of type VARCHAR(255) (or database equivalent), and numeric and timeDate columns will attempt to use appropriate database-specific column types. If you desire a specific column type or precision in your tables, you should create the table manually using and then append your data to the existing table.

EXAMPLES:

## Not run: 
exportJDBC(data=fuel.frame, driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver", 
            con="jdbc:sqlserver://qadb-s2k:1433;databaseName=testdb;user=testqa;password=testqa;", 
            user="testqa", password="testqa",
            table="TEST1", append=F)
## End(Not run)