driver: Factory function for 'JDBCDriver' objects

Description Usage Arguments Value Examples

View source: R/JDBCDriver.R

Description

Call driver to create a new JDBCDriver in order to connect to databases using the given JDBC driver.

Usage

1
2
3
4
driver(driver_class = NULL, classpath = NULL, dialect = NULL,
  read_conversions = default_read_conversions,
  write_conversions = default_write_conversions,
  create_new_connection = create_new_dbj_connection)

Arguments

driver_class

a character vector specifying the JDBC driver classes (e.g. 'org.h2.Driver')

classpath

a character vector of length one specifying classpaths separated by path.sep or a character vector of classpaths which will be added to the rJava class loader

dialect

The sql_dialect to use.

read_conversions

a list of read conversions.

write_conversions

a list of write conversions.

create_new_connection

The factory function for JDBCConnection objects.

Value

A new JDBCDriver

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(DBI)
library(dbj)

jdbc_register_driver(
 c('org.h2.Driver', 'org.apache.derby.jdbc.EmbeddedDriver'),
 resolve(
   list(
     module('com.h2database:h2:1.3.176'),
     module('org.apache.derby:derby:10.12.1.1')
   ),
   repositories = list(maven_local, maven_central)
 )
)

h2_con <- dbConnect(dbj::driver(), 'jdbc:h2:mem:example_db')
derby_con <- dbConnect(dbj::driver(), 'jdbc:derby:memory:example_db;create=true')

hoesler/dbj documentation built on May 15, 2017, 11:53 p.m.