Import From a JDBC-Compatible Database

DESCRIPTION:

Imports data from a database using JDBC drivers.

USAGE:

importJDBC(sqlQuery, table, driverClass, con, user, password, keepAlive = FALSE, bigdata = FALSE)

ARGUMENTS:

sqlQuery
The SQL query string describing the data to be retreived from the database. Required if table is not provided.
table
The name of the table to import. Required if sqlQuery is not provided. Implies sqlQuery="SELECT * FROM <table>".
driverClass
The name of the Java class for required the JDBC driver.
con
The JDBC connection string.
user
The user name with access to the 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.
bigdata
If TRUE, create and return a bdFrame object, rather than a data.frame. This allows reading much larger datasets than can be read into memory.

DETAILS:

Imports data from 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:

A data.frame containing the requested data. If bigdata is TRUE, returns a bdFrame object instead.

NOTE:

Character data can be imported into Spotfire S+ either as character or as factor. importJDBC uses the value of options(stringsAsFactors) to determine how to import the data. Warning: If using both options(stringsAsFactors=TRUE) and bigdata=TRUE , make sure to set bd.options("string.column.width") to a value at least as large as the number of characters in the longest string in your data, otherwise some string values may be truncated on import.

Some arguments can also be set using .

EXAMPLES:

## Not run: 
importJDBC(driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver", 
            con="jdbc:sqlserver://qadb-s2k:1433;databaseName=testdb;user=testqa;password=testqa;", 
            sqlQuery="SELECT * FROM FUEL_FRAME")
            
importJDBC(driverClass="COM.ibm.db2.jdbc.net.DB2Driver", 
            con="jdbc:db2://qadb1:6789/QATESTDB", 
            user="testqa", 
            password="testqa", 
            sqlQuery="SELECT * FROM FUEL_FRAME")

## End(Not run)