Description Usage Arguments Details Value DBMS parameter details Examples
createConnectionDetails
creates a list containing all details needed to connect to a
database.
1 2 | createConnectionDetails(dbms = "sql server", user, domain, password, server,
port, schema, extraSettings, oracleDriver = "thin")
|
dbms |
The type of DBMS running on the server. Valid values are
|
user |
The user name used to access the server. |
domain |
For SQL Server only: the Windows domain (optional). |
password |
The password for that user. |
server |
The name of the server. |
port |
(optional) The port on the server to connect to. |
schema |
(optional) The name of the schema to connect to. |
extraSettings |
(optional) Additional configuration settings specific to the database provider to configure things as security for SSL. These must follow the format for the JDBC connection for the RDBMS specified in dbms. |
oracleDriver |
Specify which Oracle drive you want to use. Choose between |
This function creates a list containing all details needed to connect to a database. The list can
then be used in the connect
function.
A list with all the details needed to connect to a database.
Depending on the DBMS, the function arguments have slightly different interpretations: MySQL:
user
. The user name used to access the server
password
. The password for that user
server
. The host name of the server
port
. Specifies the port on the server (default = 3306)
schema
. The database containing the tables
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "SSL Mode=Required")
Oracle:
user
. The user name used to access the server
password
. The password for that user
server
. This field contains the SID, or host and servicename, SID, or TNSName:
'<sid>', '<host>/<sid>', '<host>/<service name>', or '<tnsname>'
port
. Specifies the port on the server (default = 1521)
schema
. This field contains the schema (i.e. 'user' in Oracle terms) containing the
tables
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "(PROTOCOL=tcps)")
oracleDriver
The driver to be used. Choose between "thin" or "oci".
Microsoft SQL Server:
user
. The user used to log in to the server. If the user is not specified, Windows
Integrated Security will be used, which requires the SQL Server JDBC drivers to be installed
(see details below).
domain
. Optionally, the domain can be specified here.(See note below).
password
. The password used to log on to the server
server
. This field contains the host name of the server
port
. Not used for SQL Server
schema
. The database containing the tables. If both database and schema are specified
(e.g. 'my_database.dbo', then only the database part is used, the schema is ignored.
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "encrypt=true; trustServerCertificate=false;")
Microsoft PDW:
user
. The user used to log in to the server. If the user is not specified, Windows
Integrated Security will be used, which requires the SQL Server JDBC drivers to be installed
(see details below).
password
. The password used to log on to the server
server
. This field contains the host name of the server
port
. Not used for SQL Server
schema
. The database containing the tables
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "encrypt=true; trustServerCertificate=false;")
Connections where the domain need to be specified are not supported PostgreSQL:
user
. The user used to log in to the server
password
. The password used to log on to the server
server
. This field contains the host name of the server and the database holding the
relevant schemas: <host>/<database>
port
. Specifies the port on the server (default = 5432)
schema
. The schema containing the tables.
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "ssl=true")
Redshift:
user
. The user used to log in to the server
password
. The password used to log on to the server
server
. This field contains the host name of the server and the database holding the
relevant schemas: <host>/<database>
port
. Specifies the port on the server (default = 5439)
schema
. The schema containing the tables.
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory")
Netezza:
user
. The user used to log in to the server
password
. The password used to log on to the server
server
. This field contains the host name of the server and the database holding the
relevant schemas: <host>/<database>
port
. Specifies the port on the server (default = 5480)
schema
. The schema containing the tables.
extraSettings
The configuration settings for the connection (i.e. SSL Settings such
as "ssl=true")
To be able to use Windows authentication for SQL Server (and PDW), you have to install the JDBC driver. Download the .exe from Microsoft and run it, thereby extracting its contents to a folder. In the extracted folder you will find the file sqljdbc_4.0/enu/auth/x64/sqljdbc_auth.dll (64-bits) or sqljdbc_4.0/enu/auth/x86/sqljdbc_auth.dll (32-bits), which needs to be moved to location on the system path, for example to c:/windows/system32.
When using a Windows domain to log in to SQL Server, DatabaseConnector must rely on a non-Microsoft
driver. This driver has know issues with retrieving dates. We therefor recommend to either use
Windows integrated security, or if a different user is needed, try running RStudio using that user:
runas /netonly /user:domain\username "C:\path\to\rstudio\bin\rstudio.exe"
.
In order to enable Netezza support, place your Netezza jdbc driver at
inst/java/nzjdbc.jar
in this package.
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
connectionDetails <- createConnectionDetails(dbms = "mysql",
server = "localhost",
user = "root",
password = "blah",
schema = "cdm_v4")
conn <- connect(connectionDetails)
dbGetQuery(conn, "SELECT COUNT(*) FROM person")
dbDisconnect(conn)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.