Trouble Connecting to DB2 Database with R error 1114 - r

I've been trying to connect RStudio to a DB2 database and have been receiving the following error
rror: nanodbc/nanodbc.cpp:950: IM003: Specified driver could not be loaded due to system error 1114:
A dynamic link library (DLL) initialization routine failed.
(IBM DB2 ODBC DRIVER - DB2COPY1, C:\PROGRA~1\IBM\SQLLIB\BIN\DB2CLIO.DLL).
I've been using this code
connection<-DBI::dbConnect(odbc::odbc(),Driver="IBM DB2 ODBC DRIVER - DB2COPY1",
Server = "NRDCWIP6",uid="nxxx",pwd="Wxxx")
which has been working well for a different database (SQL server). I'm working in Windows 10 and don't have a lot of information about the database itself since it's managed by an IT group that's quite busy. I'm still quite new to connecting R to databases as well. I do know that the platform for the DSN is 32-bit, but when I look under the User DSN tab, it is listed as 32/64 bit.
I know 1114 is a rather well known error, but I'm not sure where the problem is and I've tried numerous variations of this code. Anything will help!

Here may be the answer for this situation:
Specified driver could not be loaded due to system error 1114
https://www.ibm.com/support/pages/specified-driver-could-not-be-loaded-due-system-error-1114
Here is the key note from above:
Resolving The Problem
Launch the odbcad32.exe from the Windows/SysWOW64/ folder and ensure that you have the current driver for the database version you are connecting to, specified in the Data Source that is being used in the map
Hope this helps.

Related

Could there be any language issue with a ODBC in R with an Access DB?

I am using an R Script which connects to a local Access database. For that, I used the 'odbc' package in R and created an odbc Driver in Windows. It works well on my machine.
The issue I have is, that it can't connect to the database when running the script on a foreign computer with different language settings than English. Both machines are running Windows 64-bit with Access and R on 64-bit. Running following Code:
library(odbc)
con <- dbConnect(odbc::odbc(), "AccessDB")
results in following error message:
Error in connection_info(ptr) : nanodbc/nanodbc.cpp:1072:
I didn't find a solution yet, I am thinking of using another database.
I received the same error today on a setup that usually works. After downgrading the odbc-package to 1.1.6, it works fine again.

RODBC cannot find MS Access Database [RStudio/R]

Prior to upgrading to Windows 10, I was using RODBC to establish a connection within RStudio to a MS Access database.
After upgrading to Windows 10, my workflow is halted when I try to make the same connection to the same MS Access database.
db <- "//svr/userdatabases/database.accdb"
Make a connection to the database
con2 <- odbcConnectAccess2007(db)
[RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedODBC connection failed>
I have confirmed that the database is located in the correct path (db).
Several sources have suggested that there is an issue with LD_LIBRARY_PATH, but I do not know how to implement the solutions discussed in these threads:
https://support.rstudio.com/hc/en-us/community/posts/200654626-odbcDriverConnect-works-in-R-but-not-RStudio
https://support.rstudio.com/hc/en-us/community/posts/211021467-Can-t-connect-to-SQL-database-using-RODBC-through-Rstudio-but-can-using-R-in-shell-
How do I implement the solution described in the second link? Specifically, how do I I had create a file "~/.Renviron" and add the following line:
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/nz/lib64/
According to that link, my issue is the ld library path within my rsession is not the same as my bash.
You might be missing the driver for the correct bit version of your database for RStudio to make the system connection. If your system connection works in R, but not R Studio, installing the correct driver from https://www.microsoft.com/en-us/download/confirmation.aspx?id=23734 might solve your issue.

How to get the driver version using ODBC API without connecting to the database?

We have code to connect to various databases and we get the driver version after connecting using the SQLGetInfo() call with the parameter SQL_DRIVER_VER.
However, we want the driver version in other cases too, e.g., before connecting, and in case of an error on trying to connect. The only way to get the driver version in these cases at least on Windows seems to be via the file metadata information of the driver DLL. The drivers on other platforms do not even have this file metadata.
So, is there a way to get the driver version using ODBC when we are not connected?
Thanks,
Ed
The ODBC API doesn't support this interrogation until the connection is live.
There are tricks you can bring to bear, such as those used by the iODBC Administrator.app on OS X. You might look into that source code.

FoxPro and old softwares

I have an old software running on XP. When I run it on another pc the following error arises
odbc driver manager, data source name not found and no default driver specified.
How do I get around this problem?
Note: on the old system I checked in administrative tools in data source is has foxpro drivers.
Technically that message looks like a failed attempt to create an ODBC connection via DSN ("Data Source Name") which does not exist. VFP Command Window example:
? SQLCONNECT("DsnDoesNotExist")
AERROR(laErrors)
DISPLAY MEMORY LIKE laErrors
If the original maintainer of your software did not provide any "setup" documentation, you can find the Name of the required Data Source in the source code, either as code line(s) using Vfp's SqlConnect()function, or as a "Connection" object stored in a Vfp myDatabase.DBC
If you have not got the source code, you can try to find the related "User DSN" or "System DSN" in the Windows "ODBC Data Source Administrator" of the old PC.
That DSN would contain the required connection string including driver info, e.g. "PostgreSQL" or "MS SQL Native Client", etc.
If the new system is a 64bit version, you'd need to use the 32bit version of the administration tool (usually C:\WINDOWS\SysWOW64\odbcad32.exe) in order to recreate the DSN there.
FWIW, Vfp itself does not necessarily need a "DSN" for ODBC connections - if you've got the source code, see the SqlStringConnect() function in the VFP documentation or try a web search

Data Direct ODBC for Interbase

Im trying to connect to an interBase database, using a program called Data Direct ODBC Driver for Interbase.
When i open Query1 which has fields from Table1 and Table1 is already opened, after some seconds i receive this message:
reserved error (-7713) there is no message for this error
and all the cells of (table1) shown "#deleted"
Can any one suggest how I may be able to solve this?
Updated 1-27-2015
Embarcadero who owns Interbase has an ODBC driver that is solid - http://cc.embarcadero.com/item/28975
I agree with #SamuelKDavis - the DataDirect driver will sometimes return NULL for columns which definitely have values. You can test this by creating a query and running it repeatedly through an ODBC connection and it will intermittently return NULLs.
We had also tried the IBProvider driver but ran into character set errors which we could not figure out.
Interestingly, if you lookup the history of Interbase, you'll see Borland actually made Interbase open source back in July 2000 at which point it was forked off into an open source database called "FireBird" - http://en.wikipedia.org/wiki/Firebird_(database_server)#History
Now the cool thing here is that the drivers that work with the old Firebird (v2.1 and prior) will also work with Interbase 6.0 all the way up to Interbase XE 64-bit, probably because the open source fork had not yet deviated from its Interbase roots. So try using Firebird v1.7 ADO.Net driver - http://www.firebirdsql.org/en/net-provider/
The newer Firebird drivers for .NET 2.0+ however do NOT work with Interbase.
Our company previously tried Data Direct with Interbase. It's terrible.
We suffered from random crashes using their driver, occasionally it would return nulls in the first column selected from the driver etc.
We moved to IBProvider (paid unfortunately), but have never come across an error since.

Resources