Reading Access .mdb file into R [duplicate] - r

When trying to make a program on Windows that connects to a database via ODBC, I got the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I'm sure my code is right. It even worked on a different PC.
Why am I getting this error? And How do I fix it?

What causes this error?
The error message tells you, simply put, that the ODBC Driver Manager could not find the driver you specified in your connection string or DSN.
This can have 3 common causes:
The driver you tried to use is not installed on your system
The driver is installed, however, it doesn't match bitness of the code you're running
You made an error in typing the driver name
How do I check which drivers are installed on my system?
You can check the drivers which are installed on your system by going to the ODBC Data Source Administrator. To open it, press ⊞ Win + R, and type in: odbcad32.exe. Then check the tab Drivers for installed drivers. The Name column indicates the exact name you should use in your connection string or DSN.
If you're on 64-bit Windows, that only lists the 64-bit drivers installed on
your system. To see which 32-bit drivers are installed, press press ⊞ Win + R, and type in: C:\Windows\SysWOW64\odbcad32.exe, and go to the Drivers tab again.
The driver is installed, but it might be the wrong bitness, what do I do?
Then, you have two choices, either adjust the bitness your program is running in, or install a driver with a different bitness.
Some of the drivers that are installed by default on Windows only have a 32-bits variant. These can't be used with 64-bits programs.
You can usually identify which bitness a program is running under in task manager. In Windows 10, all 32-bit programs have (32-bit) appended to their name. If that isn't there, you're likely running a 64-bit program, and most modern programming languages and environments run on 64-bit by default, but allow you to switch to 32-bit. However, the specifics for different programming languages are outside the scope of this question.
How can I verify I didn't mistype the driver name?
An ODBC connection string looks like this:
DRIVER={DriverName};ParameterName1=ParameterValue1;ParameterNameN=ParameterValueN;
The driver name part needs to be delimited by curly braces if it might contain special characters, and needs to exactly match the installed driver name, as found in the ODBC Data Source Administrator, including spaces and typographical characters, but excluding capitalization.
Note that for deployed code, the driver must be present on the computer/server running the code.
I don't have the driver, or have the wrong bitness, where do I get the right one?
That depends on which driver you want to use.
A list of common drivers with download locations (all 32-bit and 64-bit at the same URL):
The Microsoft ODBC Driver 17 for SQL Server
The Microsoft Access database driver, which is part of the Microsoft Access Database Engine. Note that simultaneous installations of 32-bit and 64-bit Access ODBC drivers are not supported.
The MySQL ODBC connector by Oracle
The open-source SQLite ODBC driver by Christian Werner (non-official)
psqlODBC, the official PostgreSQL driver
If the driver you want to use isn't listed, the location is usually easily found using Google.

In design mode, a value has been set to the property of
TFDConnection.ConnectionDefName must be empty.

Related

How to connect 64-bit R (without setting it to 32-bit) to 32- bit MS Access [duplicate]

When trying to make a program on Windows that connects to a database via ODBC, I got the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I'm sure my code is right. It even worked on a different PC.
Why am I getting this error? And How do I fix it?
What causes this error?
The error message tells you, simply put, that the ODBC Driver Manager could not find the driver you specified in your connection string or DSN.
This can have 3 common causes:
The driver you tried to use is not installed on your system
The driver is installed, however, it doesn't match bitness of the code you're running
You made an error in typing the driver name
How do I check which drivers are installed on my system?
You can check the drivers which are installed on your system by going to the ODBC Data Source Administrator. To open it, press ⊞ Win + R, and type in: odbcad32.exe. Then check the tab Drivers for installed drivers. The Name column indicates the exact name you should use in your connection string or DSN.
If you're on 64-bit Windows, that only lists the 64-bit drivers installed on
your system. To see which 32-bit drivers are installed, press press ⊞ Win + R, and type in: C:\Windows\SysWOW64\odbcad32.exe, and go to the Drivers tab again.
The driver is installed, but it might be the wrong bitness, what do I do?
Then, you have two choices, either adjust the bitness your program is running in, or install a driver with a different bitness.
Some of the drivers that are installed by default on Windows only have a 32-bits variant. These can't be used with 64-bits programs.
You can usually identify which bitness a program is running under in task manager. In Windows 10, all 32-bit programs have (32-bit) appended to their name. If that isn't there, you're likely running a 64-bit program, and most modern programming languages and environments run on 64-bit by default, but allow you to switch to 32-bit. However, the specifics for different programming languages are outside the scope of this question.
How can I verify I didn't mistype the driver name?
An ODBC connection string looks like this:
DRIVER={DriverName};ParameterName1=ParameterValue1;ParameterNameN=ParameterValueN;
The driver name part needs to be delimited by curly braces if it might contain special characters, and needs to exactly match the installed driver name, as found in the ODBC Data Source Administrator, including spaces and typographical characters, but excluding capitalization.
Note that for deployed code, the driver must be present on the computer/server running the code.
I don't have the driver, or have the wrong bitness, where do I get the right one?
That depends on which driver you want to use.
A list of common drivers with download locations (all 32-bit and 64-bit at the same URL):
The Microsoft ODBC Driver 17 for SQL Server
The Microsoft Access database driver, which is part of the Microsoft Access Database Engine. Note that simultaneous installations of 32-bit and 64-bit Access ODBC drivers are not supported.
The MySQL ODBC connector by Oracle
The open-source SQLite ODBC driver by Christian Werner (non-official)
psqlODBC, the official PostgreSQL driver
If the driver you want to use isn't listed, the location is usually easily found using Google.
In design mode, a value has been set to the property of
TFDConnection.ConnectionDefName must be empty.

How to setup 64-bit ODBC data source in UiPath?

I am trying to set up a 64-bit ODBC data source connection in UiPath, but it's not visible and only showing 32-bit data sources.
Is it because UiPath is a 32-bit software? Please suggest an alternate workaround.
A 32-bit application can only load 32-bit ODBC drivers.
Your options are to --
find a 64-bit version of your "UiPath" application
find a 32-bit version of the 64-bit "Oracle in XE" driver
find a 32-bit ODBC Driver for 64-bit ODBC Data Sources (such as this, from my employer, available for immediate download with free two-week trial license)
Connect activity in UiPath drops down only 32bit data sources. I solved this using following method.
Go to Oracle official website and download Oracle Instant Client 32
bit. (Link1)
Download Basic Package (in Base section), SDK Package and ODBC
Package (in Develpoment and Runtime section).
Extract them in a directory.
There will be folder created similar to instantclient_19_3. Open this
folder and run odbc_install.exe (Might prompt for administrator
privilegs)
Sometimes there might be messages stating that "This program is not
installed correctly". Ignore this message.
That's all. Create a data source using ODBC Data Source Administrator Application(32 bit) in Windows machine.There you will be able to create an Oracle data source using Oracle instantclient_19_3 driver.
Refer image
After successful creation of this data source, now you will be able to see your data source from UiPath Connect activity.

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

Troubles with JDBC-ODBC, DSN-less connection strings, and 64-bit Windows 7

I'm dealing with an issue that has arisen for an application I've been working on which connects to a Access file via JDBC-ODBC. On other Windows platforms, this issue hasn't been encountered, but on Windows 7 64-bit boxes, attempting to connect with DSN-less connection strings return:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Multiple variations on the string have been attempted, but all of them have returned the same error. Here's how it currently tries to connect:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
StringBuffer databaseConnectionString;
if (SystemUtils.IS_OS_WINDOWS_7) {
databaseConnectionString = new StringBuffer("jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=");
databaseConnectionString.append(databaseFile);
} else {
databaseConnectionString = new StringBuffer("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=");
databaseConnectionString.append(databaseFile);
databaseConnectionString.append(";DriverID=22;READONLY=false}");
}
Examining the driver in the 32-bit ODBC Data Source Admin confirms that the drivers are present. However, when regedt32.exe is used to examine ODBC drivers (HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBCINST.INI/ODBC Drivers), none of them appear.
Can anyone help to shed some light on this?
I found the problem was that I was running the program in 64-bit Java. Although I have yet to successfully have the program detect if it's running in 32-bit or 64-bit Java, I have solved the solution by installing a 32-bit Java runtime environment and using a .bat file that reads as follows:
#echo off
"C:\Program Files (x86)\Java\jre6\bin\java" -D32 -Xmx1024m -jar programName.jar
Thanks for the help!
This was a difficult challenge given the paucity of meaningful error messages from JAVA or MS's ODBC driver. The answers above about down selecting to 32bit Java and MS Access drivers (using AccessDatabaseEngine.exe from MS) did work but cost a significant penalty (about 30%) in processing other actions compared to using 64bit Java. I was unwilling to pay this price so I installed 64bit Java (in conjunction with 32bit, both in a separate directory c:\Java\32 or 64). This latter directory issue was important for me since I was using Apache Geronimo and it would not start if Java was installed in Program Files (x86)... as the (x86) seemed to kill its batch file parsing. I then uninstalled 32bit MS Access and installed 64bit MS Access (AccessDatabaseEngine_x64.exe). Finally, it worked with both higher speed and MDB connection.

JET and ODBC driver missing, can not get data from MDBs

These are MY symptoms: (XP Pro, 32bit)
-Programs that access .mdb databases (aside from Access 2007 itself) can not get any data.
-Using the Data Sources in Visual Studio 2008 to connect to an MDB shows tables, but you can not query. you receive "Unknown Error" from the Microsoft JET Database Engine
-ArcCatalog can not read a personal geodatabase (mdb), after opening the database it has no feature classes within it
-Trying to bring up the properties of a User DSN "MS Access Database" in the ODBC Data Source Administrator returns error
"The setup routines for the Microsoft Access Driver (*.mdb, *.accdb) ODBC driver could not be found. Please reinstall the driver."
I attempted to reinstall latest MDAC (by setting it to compatibility mode of windows 2000) and latest JET driver. Reinstalled XP SP3.
Also tried a lot of regsvr32 gymnastics with the dao350.dll and dao360.dll, uninstalled the dao350, etc, etc. Nothing worked.
(Yes, I'm answering my own question, to record my solution)
I should also note, in addition to above, I couldn't use the SQL Native Client driver either.
In the registry, under HKLM\SOFTWARE\ODBC the \ODBC.INI branch contains any defined connections, and the \ODBCINST.INI contains records for the installed drivers.
I checked a similar development machine, and my ODBCINST.INI was missing A LOT of entries. I blame the ccleaner application that was recently used to clean up my system of junk.
After exporting the registry branch from the other computer, and importing over my existing keys, everything worked again.
Below are some of the core records, to generate a .reg script. You should get the full list from a similar machine to yours.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI]
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Access Driver (*.mdb)]
"UsageCount"=dword:00000002
"Driver"="C:\\WINDOWS\\system32\\odbcjt32.dll"
"Setup"="C:\\WINDOWS\\system32\\odbcjt32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"FileUsage"="2"
"FileExtns"="*.mdb"
"SQLLevel"="0"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Access Driver (*.mdb, *.accdb)]
"UsageCount"=dword:00000003
"Driver"="C:\\PROGRA~1\\COMMON~1\\MICROS~1\\OFFICE12\\ACEODBC.DLL"
"Setup"="C:\\PROGRA~1\\COMMON~1\\MICROS~1\\OFFICE12\\ACEODBC.DLL"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"FileUsage"="2"
"FileExtns"="*.mdb,*.accdb"
"SQLLevel"="0"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Excel Driver (*.xls)]
"UsageCount"=dword:00000002
"Driver"="C:\\WINDOWS\\system32\\odbcjt32.dll"
"Setup"="C:\\WINDOWS\\system32\\odexl32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"FileUsage"="1"
"FileExtns"="*.xls"
"SQLLevel"="0"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)]
"UsageCount"=dword:00000003
"Driver"="C:\\PROGRA~1\\COMMON~1\\MICROS~1\\OFFICE12\\ACEODBC.DLL"
"Setup"="C:\\PROGRA~1\\COMMON~1\\MICROS~1\\OFFICE12\\ACEODEXL.DLL"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"FileUsage"="2"
"FileExtns"="*.xls,*.xlsx, *.xlsb"
"SQLLevel"="0"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\SQL Native Client]
"UsageCount"=dword:00000001
"Driver"="c:\\WINDOWS\\system32\\sqlncli.dll"
"Setup"="c:\\WINDOWS\\system32\\sqlncli.dll"
"APILevel"="2"
"ConnectFunctions"="YYY"
"CPTimeout"="60"
"DriverODBCVer"="09.00"
"FileUsage"="0"
"SQLLevel"="1"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\SQL Server]
"UsageCount"=dword:00000002
"Driver"="C:\\WINDOWS\\system32\\SQLSRV32.dll"
"Setup"="C:\\WINDOWS\\system32\\sqlsrv32.dll"
"SQLLevel"="1"
"FileUsage"="0"
"DriverODBCVer"="03.50"
"ConnectFunctions"="YYY"
"APILevel"="2"
"CPTimeout"="60"

Resources