Package 'odbc32'

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

Help Index


odbc32: 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.


Append a (new) connection to a global list of connections

Description

Append a (new) connection to a global list of connections

Usage

.append_con(con)

Arguments

con

Value

a reference (index) number to the list of all connections

Examples

#TBA

Closes odbc32 connection

Description

Closes odbc32 connection

Usage

## S3 method for class 'odbc32'
close(con)

Arguments

con

odbc32 connection object

Value

logical

Examples

TBA

Connect to Database Via ODBC using RODBC

Description

This helper function is used by

Usage

connect_remotely(socket, FUN, ns = "RODBC", ...)

Arguments

socket

socket

FUN

function to be called remotely

...

arguments to be passed to FUN

Value

odbc32 object


Create Object of Class "odbc32"

Description

Create Object of Class "odbc32"

Usage

create_odbc32_object(socket, ref)

Arguments

socket

socket

ref

reference returned by eval_remote


writing data into MS Access via 32bit R session script

Description

Procedure for easier exporting of data from an R into MS Access database via separate 32-bit R session script

Usage

data2access(
  data,
  accdb_file,
  overwrite = FALSE,
  fast = TRUE,
  safer = TRUE,
  rownames = FALSE,
  ...
)

Arguments

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

Details

overwrite

logical; Attempt to drop any existing table of the name before writing data?

convert_dates

character; Convert dates as text before writing into database.


Default Socket

Description

Currently, this is just a shortcut to .GlobalEnv$.r2r_socket

Usage

default_socket()

Specify or retrieve a mapping of R types to DBMS datatypes.

Description

Specify or retrieve a mapping of R types to DBMS datatypes.

Usage

getSqlTypeInfo(con, driver)

setSqlTypeInfo(con, driver, value)

setSqlTypeInfo2(con, driver, value)

Arguments

con

odbc32 object

value

passed to RODBC::setSqlTypeInfo

Details

setSqlTypeInfo2 is a custom implementation for cases when setSqlTypeInfo fails on "locked environment" error

Value

For setSqlTypeInfo none. For getSqlTypeInfo with an argument, a named list. Without an argument, a data frame.


close odbc32 connection

Description

close odbc32 connection

Usage

odbcClose(con)

Arguments

con

odbc32 connection object


establish ODBC connection defined by DSN name

Description

establish ODBC connection defined by DSN name

Usage

odbcConnect(dsn, uid = "", pwd = "", socket = default_socket())

Arguments

dsn

dsn

uid

user name

pwd

password

socket

socket


Connect to an Access database (*.mdb)

Description

Connect to an Access database (*.mdb)

Usage

odbcConnectAccess(access.file, uid = "", pwd = "", socket = default_socket())

Arguments

access.file

path to .mdb file

uid

user name

pwd

password

Value

odbc32 object

Examples

#TBA

Connect to an Access 2007 database

Description

Connect to an Access 2007 database

Usage

odbcConnectAccess2007(
  access.file,
  uid = "",
  pwd = "",
  socket = default_socket()
)

Arguments

access.file

path to .accdb file

uid

user name

pwd

password

Value

odbc32 object

Examples

#TBA

list data sources

Description

list data sources

Usage

odbcDataSources(type = c("all", "user", "system"), socket = default_socket())

Arguments

type

see type param of RODBC::odbcDataSources()


establish ODBC connection based on a connection string

Description

establish ODBC connection based on a connection string

Usage

odbcDriverConnect(..., socket = default_socket())

Arguments

...

other args passed to RODBC::odbcDriverConnect()

socket

clear/empty a db table

Description

clear/empty a db table

Usage

odbcEndTran(con, commit)

Arguments

con

odbc32 connection object

commit

logical


Get error message

Description

Get error message

Usage

odbcGetErrMsg(con)

Arguments

con

odbc32 object


Information on an ODBC connection.

Description

see RODBC::odbcGetInfo()

Usage

odbcGetInfo(con)

Arguments

con

odbc32 connection object


Path to File in This Package

Description

Path to File in This Package

Usage

package_file(..., mustWork = FALSE)

Arguments

...

passed to system.file

mustWork

passed to system.file

Value

absolute file path to a file in the installation folder of this package


print method for odbc32

Description

print method for odbc32

Usage

## S3 method for class 'odbc32'
print(x)

Arguments

x

odbc32 object

Value

printed odbc32 object

Examples

#TBA

Query over remote connection

Description

Query over remote connection

Usage

remote_access_query(...)

Arguments

...

is passed to r2r::do.call_remote

Value

whatever the call on the remote R session returns

Examples

#TBA

Path to Rscript.exe (on Windows)

Description

Path to Rscript.exe (on Windows)

Usage

rscript_path(arch = "i386")

Arguments

arch

architecture: "i386" for 32 bit or "x64" for 64 bit

Value

absolute file path to "Rscript.exe"


clear/empty a db table

Description

clear/empty a db table

Usage

sqlClear(con, name)

Arguments

con

odbc32 connection object

name

name of db table to be dropped


drop a db table

Description

drop a db table

Usage

sqlDrop(con, name)

Arguments

con

odbc32 connection object

name

name of db table to be dropped


fetch db table

Description

fetch db table

Usage

sqlFetch(con, name, ...)

sqlFetchMore(con, ...)

Arguments

con

odbc32 connection object

name

name of db table to be dropped

...

other args passed to RODBC::sqlFetch() on remote

Value

data.frame


send query to a db and get results

Description

send query to a db and get results

Usage

sqlQuery(con, query, errors = NULL, ...)

Arguments

con

odbc32 connection object

query

text of the query

...

other args passed to RODBC::sqlQuery() on remote


upload table to a db

Description

upload table to a db

Usage

sqlSave(con, data, name = NULL, ...)

Arguments

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

Description

list tables in DB

Usage

sqlTables(con, errors = NULL, ...)

Arguments

con

odbc32 connection object

errors

ignored

...

other args passed to RODBC::sqlTables() on remote


update db table

Description

update db table

Usage

sqlUpdate(con, data, name = NULL, ...)

Arguments

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

Description

Start a new R session with a running r2r server

Usage

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
)

Arguments

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

Value

socket connection (invisible)

Examples

#TBA

Start r2r server connected to an Access database over 32-bit ODBC driver

Description

Start r2r server connected to an Access database over 32-bit ODBC driver

Usage

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

Description

Stop r2r server running on a remote R session

Usage

stop_server(...)

Arguments

...

args passed to r2r::stop_remote()

Value

logical

Examples

#TBA

export data from Rdata file into MS Access db via separate 32-bit Rscript

Description

export data from Rdata file into MS Access db via separate 32-bit Rscript

Usage

write_access_db(rdata_file)