In this method, we execute the following command:
> con <- odbcConnect("cust_dsn", uid="user", pwd="pwd")
The con variable now has a connection to the database associated with the DSN. All subsequent database calls use this connection object. When all database operations are done, we close the connection.
Although we will typically not create tables or insert data from R, we have shown the code for this just for illustration. The sqlSave function saves the data in the R data object to the specified table. We used append=FALSE because the table does not already exist, and, hence, we will want R to create the table first and then insert the data. If the table already exists, you can use append=TRUE.
The sqlQuery function executes ...