kylemaxxwell / rpostgresql

Automatically exported from code.google.com/p/rpostgresql
0 stars 0 forks source link

crash on dbConnect() #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. install.packages("RPostgreSQL", type="source")

2. library(RPostgreSQL)
3. con <- dbConnect(PostgreSQL(), user= "*", host="*", dbname="*", password="*"

What is the expected output? What do you see instead?
>

Traceback:
 1: .Call("RS_PostgreSQL_newConnection", drvId, con.params, PACKAGE = .PostgreSQLPkgName)
 2: postgresqlNewConnection(drv, ...)
 3: is(object, Cl)
 4: is(object, Cl)
 5: .valueClassTest(standardGeneric("dbConnect"), "DBIConnection",     "dbConnect")
 6: dbConnect(PostgreSQL(), user = "ipluta", host = "kiwi.cmr.net.pl",     dbname = "wafel", password = "")
Error in postgresqlNewConnection(drv, ...) : 
  caught access violation - continue with care
>

What version of the product are you using? On what operating system?

R x64 2.14.0 on Windows 7

Please provide any additional information below.

dlls of c:\program files\postgresql\9.1\bin manually copied to 
c:\windows\system32

Original issue reported on code.google.com by ipl...@wp.pl on 7 Nov 2011 at 7:09

GoogleCodeExporter commented 8 years ago
Information on exact windows version (32 bit vs 64 bit), compiler setup, and 
how PostgreSQL and R binary were compiled and installed is necessary to 
investigate anything further. If the DLL for PostgreSQL and R is compiled with 
different compiler setup, it is unlikely to work.

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 8 Nov 2011 at 7:22

GoogleCodeExporter commented 8 years ago
Hi, thanks for response.

This is Windows 7 64bit.

Both PostreSQL and R were installed with their Windows installers from binary 
packages. RPostgreSQL was attempted to be built from source because:

> install.packages("RPostgreSQL")
(...)
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ‘RPostgreSQL’ is not available (for R version 2.14.0)
> 

In order to be able to compile RPostgreSQL I downloaded and installed latest 
RTools.

It seems, based on the above, that compiler setup for RPostgreSQL compile is 
unlikely to follow the setup the R was compiled with for the binary package 
contained in Windows installer. How to make my setup consistent with that one?

Original comment by ipl...@wp.pl on 8 Nov 2011 at 9:17

GoogleCodeExporter commented 8 years ago
Install MinGW and MSYS by mingw-get-inst. 
http://www.mingw.org/wiki/Getting_Started
Note postgresql-9.1.1 cannot be compiled with make-3.79 that comes with Rtools
http://www.murdoch-sutherland.com/Rtools/Rtools214.exe
as of 2011-11-11.

In MSYS environment, compile postgresql-9.1.1 with 
./configure --host=x86_64-w64-mingw32 --without-zlib
make

Thereafter,
make install
would install the postgresql binaries to C:\MinGW\MSYS\1.0\local\pgsql

You find libpq.dll in src/interfaces/libpq under the postgresql-9.1.1 directory 
or
C:\MinGW\MSYS\1.0\local\pgsql\lib,
copy the file to the x64 directory of the R binary, 
eg. C:\Program Files\R\R-2.14.0\bin\x64
(Usually user is better not to touch c:\windows\system32)

set the environmental variable PG_HOME to
C:/MinGW/MSYS/1.0/local/pgsql
and invoke R.

As the windows native binary distribution of PostgreSQL is compiled 
using the Visual C++ compiler suite from Microsoft 
(http://www.postgresql.org/docs/9.1/static/install-windows.html), their 
component cannot
linked with the mingw binaries.  However, the transaction is done over socket or
TCP/IP and you can interact with the binary installation without problem.

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 11 Nov 2011 at 9:25

GoogleCodeExporter commented 8 years ago
This will be closed as this is caused by inappropriate installation, and the 
installation procedure is now much simplified that same error should not be 
seen.

Original comment by tomoa...@kenroku.kanazawa-u.ac.jp on 21 Nov 2011 at 1:23