Here is a small brief primer for beginners on configuring an open source database and using an open source analytics package.
All you need to know – is to read!
http://www.postgresql.org/download/windowsInstall PostgreSQL
Remember to store /memorize the password for the user postgres!
Create a connection using pgAdmin feature in Start Menu
2. download ODBC driver from
http://www.postgresql.org/ftp/odbc/versions/msi/
and the Win 64 edition from
http://wwwmaster.postgresql.org/download/mirrors-ftp/odbc/versions/msi/psqlodbc_09_00_0310-x64.zip
install ODBC driver
3. Go to
Start Menu\Control Panel\All Control Panel Items\Administrative Tools\Data Sources (ODBC)
4. Configure the following details in System DSN and User DSN using the ADD tabs .Test connection to check if connection is working
5. Start R and install and load library RODBC
6. Use following initial code for R- if you know SQL you can do the rest
> library(RODBC)
> odbcDataSources(type = c(“all”, “user”, “system”))
SQLServer PostgreSQL30 PostgreSQL35W
“SQL Server” “PostgreSQL ANSI(x64)” “PostgreSQL Unicode(x64)”
> ajay=odbcConnect(“PostgreSQL30”, uid = “postgres”, pwd = “XX”)
> sqlTables(ajay)
TABLE_QUALIFIER TABLE_OWNER TABLE_NAME TABLE_TYPE REMARKS
1 postgres public names TABLE
> crimedat <- sqlFetch(ajay, “names”)
Ajay, what about connecting R to MySQL ?
done