Title: | 32-bit ODBC drivers for 64-bit R sessions |
---|---|
Description: | Tools for using 32-bit ODBC drivers from 64-bit R sessions. Based on socket connection between 64-bit R and host 32-bit R. |
Authors: | Vaclav Hausenblas |
Maintainer: | Vaclav Hausenblas <[email protected]> |
License: | MIT |
Version: | 0.2.9.9002 |
Built: | 2024-11-01 06:10:16 UTC |
Source: | https://github.com/hsonne/odbc32 |
Tools for using 32-bit ODBC drivers from 64-bit R sessions. Based on socket connection between 64-bit R and host 32-bit R.
Append a (new) connection to a global list of connections
.append_con(con)
.append_con(con)
con |
a reference (index) number to the list of all connections
#TBA
#TBA
Closes odbc32 connection
## S3 method for class 'odbc32' close(con)
## S3 method for class 'odbc32' close(con)
con |
odbc32 connection object |
logical
TBA
TBA
This helper function is used by
connect_remotely(socket, FUN, ns = "RODBC", ...)
connect_remotely(socket, FUN, ns = "RODBC", ...)
socket |
socket |
FUN |
function to be called remotely |
... |
arguments to be passed to |
odbc32 object
Create Object of Class "odbc32"
create_odbc32_object(socket, ref)
create_odbc32_object(socket, ref)
socket |
socket |
ref |
reference returned by |
Procedure for easier exporting of data from an R into MS Access database via separate 32-bit R session script
data2access( data, accdb_file, overwrite = FALSE, fast = TRUE, safer = TRUE, rownames = FALSE, ... )
data2access( data, accdb_file, overwrite = FALSE, fast = TRUE, safer = TRUE, rownames = FALSE, ... )
data |
a named list of tables |
accdb_file |
path to accdb file |
overwrite |
logical; TRUE for an attempt to drop each table first. |
fast |
passed to RDOBC::sqlSave |
safer |
passed to RDOBC::sqlSave |
rownames |
passed to RDOBC::sqlSave |
... |
passed to RDOBC::sqlSave |
logical; Attempt to drop any existing table of the name before writing data?
character; Convert dates as text before writing into database.
Currently, this is just a shortcut to .GlobalEnv$.r2r_socket
default_socket()
default_socket()
Specify or retrieve a mapping of R types to DBMS datatypes.
getSqlTypeInfo(con, driver) setSqlTypeInfo(con, driver, value) setSqlTypeInfo2(con, driver, value)
getSqlTypeInfo(con, driver) setSqlTypeInfo(con, driver, value) setSqlTypeInfo2(con, driver, value)
con |
odbc32 object |
value |
passed to |
setSqlTypeInfo2
is a custom implementation for cases when setSqlTypeInfo fails on "locked environment" error
For setSqlTypeInfo none. For getSqlTypeInfo with an argument, a named list. Without an argument, a data frame.
close odbc32 connection
odbcClose(con)
odbcClose(con)
con |
odbc32 connection object |
establish ODBC connection defined by DSN name
odbcConnect(dsn, uid = "", pwd = "", socket = default_socket())
odbcConnect(dsn, uid = "", pwd = "", socket = default_socket())
dsn |
dsn |
uid |
user name |
pwd |
password |
socket |
socket |
Connect to an Access database (*.mdb)
odbcConnectAccess(access.file, uid = "", pwd = "", socket = default_socket())
odbcConnectAccess(access.file, uid = "", pwd = "", socket = default_socket())
access.file |
path to .mdb file |
uid |
user name |
pwd |
password |
odbc32 object
#TBA
#TBA
Connect to an Access 2007 database
odbcConnectAccess2007( access.file, uid = "", pwd = "", socket = default_socket() )
odbcConnectAccess2007( access.file, uid = "", pwd = "", socket = default_socket() )
access.file |
path to .accdb file |
uid |
user name |
pwd |
password |
odbc32 object
#TBA
#TBA
list data sources
odbcDataSources(type = c("all", "user", "system"), socket = default_socket())
odbcDataSources(type = c("all", "user", "system"), socket = default_socket())
type |
see type param of RODBC::odbcDataSources() |
establish ODBC connection based on a connection string
odbcDriverConnect(..., socket = default_socket())
odbcDriverConnect(..., socket = default_socket())
... |
other args passed to RODBC::odbcDriverConnect() |
socket |
clear/empty a db table
odbcEndTran(con, commit)
odbcEndTran(con, commit)
con |
odbc32 connection object |
commit |
logical |
Get error message
odbcGetErrMsg(con)
odbcGetErrMsg(con)
con |
odbc32 object |
see RODBC::odbcGetInfo()
odbcGetInfo(con)
odbcGetInfo(con)
con |
odbc32 connection object |
Path to File in This Package
package_file(..., mustWork = FALSE)
package_file(..., mustWork = FALSE)
... |
passed to |
mustWork |
passed to |
absolute file path to a file in the installation folder of this package
print method for odbc32
## S3 method for class 'odbc32' print(x)
## S3 method for class 'odbc32' print(x)
x |
odbc32 object |
printed odbc32 object
#TBA
#TBA
Query over remote connection
remote_access_query(...)
remote_access_query(...)
... |
is passed to r2r::do.call_remote |
whatever the call on the remote R session returns
#TBA
#TBA
Path to Rscript.exe (on Windows)
rscript_path(arch = "i386")
rscript_path(arch = "i386")
arch |
architecture: "i386" for 32 bit or "x64" for 64 bit |
absolute file path to "Rscript.exe"
clear/empty a db table
sqlClear(con, name)
sqlClear(con, name)
con |
odbc32 connection object |
name |
name of db table to be dropped |
drop a db table
sqlDrop(con, name)
sqlDrop(con, name)
con |
odbc32 connection object |
name |
name of db table to be dropped |
fetch db table
sqlFetch(con, name, ...) sqlFetchMore(con, ...)
sqlFetch(con, name, ...) sqlFetchMore(con, ...)
con |
odbc32 connection object |
name |
name of db table to be dropped |
... |
other args passed to RODBC::sqlFetch() on remote |
data.frame
send query to a db and get results
sqlQuery(con, query, errors = NULL, ...)
sqlQuery(con, query, errors = NULL, ...)
con |
odbc32 connection object |
query |
text of the query |
... |
other args passed to RODBC::sqlQuery() on remote |
upload table to a db
sqlSave(con, data, name = NULL, ...)
sqlSave(con, data, name = NULL, ...)
con |
odbc32 object |
data |
tabular data |
name |
name of the resulting db table |
... |
other args passed to RODBC::sqlSave() on remote |
list tables in DB
sqlTables(con, errors = NULL, ...)
sqlTables(con, errors = NULL, ...)
con |
odbc32 connection object |
errors |
ignored |
... |
other args passed to RODBC::sqlTables() on remote |
update db table
sqlUpdate(con, data, name = NULL, ...)
sqlUpdate(con, data, name = NULL, ...)
con |
odbc32 connection object |
data |
tabular data object |
name |
name of the resulting db table |
... |
other args passed to RODBC::sqlUpdate() on remote |
Start a new R session with a running r2r server
start_server( address = "tcp://localhost", port = pbdZMQ::random_open_port(), arch = "i386", Rbin = rscript_path(arch), r_args = NULL, invisible = FALSE, wait = FALSE, global = TRUE, debug = FALSE )
start_server( address = "tcp://localhost", port = pbdZMQ::random_open_port(), arch = "i386", Rbin = rscript_path(arch), r_args = NULL, invisible = FALSE, wait = FALSE, global = TRUE, debug = FALSE )
address |
host address |
port |
port |
arch |
architecture |
Rbin |
path to Rscript binary |
r_args |
further arguments to Rscript command |
invisible |
logical; visibility of the new session window |
socket connection (invisible)
#TBA
#TBA
Start r2r server connected to an Access database over 32-bit ODBC driver
start_server_access2007( accdb_fp, invisible = FALSE, wait = FALSE, address = "tcp://*", port = pbdZMQ::random_open_port(), arch = "i386", Rbin = rscript_path(arch) )
start_server_access2007( accdb_fp, invisible = FALSE, wait = FALSE, address = "tcp://*", port = pbdZMQ::random_open_port(), arch = "i386", Rbin = rscript_path(arch) )
Stop r2r server running on a remote R session
stop_server(...)
stop_server(...)
... |
args passed to r2r::stop_remote() |
logical
#TBA
#TBA
export data from Rdata file into MS Access db via separate 32-bit Rscript
write_access_db(rdata_file)
write_access_db(rdata_file)