Description Usage Arguments Details Value Note See Also Examples
Exports data to a database using JDBC drivers.
1 2 3 4 5 6 | exportJDBC(data, table, appendToTable = TRUE,
driverClass = sjdbcOptions()$driverClass, con = sjdbcOptions()$con,
user = sjdbcOptions()$user, password = sjdbcOptions()$password,
keepAlive = sjdbcOptions()$keepAlive, preserveColumnCase = FALSE,
batchSize = sjdbcOptions()$batchSize,
useTransaction = sjdbcOptions()$useTransaction)
|
data |
the |
table |
a string containing the name of the database table. |
appendToTable |
a logical. If |
driverClass |
a string containing the name of the Java class for the required JDBC driver. |
con |
a string specifying the JDBC connection string. |
user |
a string containing the user name with access to database. |
password |
a string containing the password for the given user name on the database. |
keepAlive |
a logical. If |
preserveColumnCase |
a logical. If |
batchSize |
an integer specifying the number of rows sent to the database in each batch, if batch updates are supported by the JDBC driver.
Default value is |
useTransaction |
If |
Exports data to the database using the JDBC driver specified in driverClass
. The required JDBC driver must be
loaded in sjdbc
before use. See loadJDBCDriver
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.
Setting a larger value for the batchSize
argument can improve efficiency when you need to export large data tables, if batch updates are supported by
the JDBC driver.
returns the number of rows exported.
Some arguments can also be set using sjdbcOptions
.
When you export to a new table (appendToTable=FALSE
), you might find that the column types of the resulting table are not as desired. Columns containing
text data are of type VARCHAR(255)
(or database equivalent), and numeric and timeDate
columns attempt to use appropriate
database-specific column types. If you want a specific column type or precision in your tables, you should create the table manually using
executeJDBC
, and then append your data to the existing table.
loadJDBCDriver
, sjdbcOptions
, executeJDBC
1 2 3 4 5 6 7 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.