openDBConnection
.
closeDBConnection()
T
or
F
will be returned.
T
is returned if successful.
Normally an ODBC data source is opened when an
importData
,
exportData
, or
executeSQL
call
is made and then closed when the command finishes. In some circumstances, you may wish
to leave the connection open so that multiple consecutive calls to these functions can
be made without opening and closing the connection between calls. This will improve
efficiency and speed of the overall operation.
After calling
openDBConnection
and then issuing a series
of
importData
,
exportData
, or
executeSQL
commands,
you must call
closeDBConnection
to close the connection.
When you exit S-PLUS, all open connections are closed automatically.
sODBCConn <- "DSN=ORACLE;UID=TESTQA;PWD=TESTQA;DBQ=ORACLE.TESTDB;DBA=W;APA=T; EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=F; BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=F;PFC=10;TLO=0;" openDBConnection() executeSQL(type = "ODBC", odbcConnection=sODBCConn, user = "testqa", password = "testqa", sqlQuery = "create table MYTABLE as select * from FUELFRAME") # Connection to the ODBC database remains open after this executeSQL call # so that the next call does not need to reopen the database connection executeSQL(type = "ODBC", odbcConnection=sODBCConn, user = "testqa", password = "testqa", sqlQuery = "create table MYTABLE2 as select * from FUELFRAME") closeDBConnection()