How can we set oledb provider for 64 bit operating system - c#

I want to get oledb provider for jet 4.0 in my sql. I am using 64 bit version of windows.
I have created a linked server to access the access database and import that database to sql.
So, I have written one stored procedure to create a linked server there i mentioned provider as Microsoft oledb jet 4.0.
I got error like this in 64 bit
'OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.'
In 32 bit windows it is working fine. I installed microsoft oledb jet drivers. But in 64 bit It is not being installed.
Can u pls tell me the suggestion to get provider oledb jet 4.0 in Sql linked servers.

When you need to use MS Access database, you need to install a database access engine. Check the link: https://www.microsoft.com/en-us/download/details.aspx?id=13255 Also consider the version of the Access you have installed on the host machine in your connection string.

For me what works is to install the database driver from:
The 2016 Access Redistributable
https://www.microsoft.com/en-us/download/details.aspx?id=54920
And then adjust my connection string for example:
connection.ConnectionString = #"Provider=Microsoft.ACE.OLEDB.16.0;Data Source=F:\SKS\SKSDatabase\Orders.mdb";

Related

How C# connection to Access DB without MS Access?

What do I need to do so that I can work with Access DB database file in C# without installing MS Access?
I make a program for a computer on which MS Access is not installed
You don't need to install the office setup in your system, but you do need to install either the ACE or the JET engine driver with the correct bit version to use Access files in your code. The 32 bit engine driver will not work with 64 bit OS version and vice versa.
Have a look here:
for download and instruction
https://www.microsoft.com/en-gb/download/details.aspx?id=13255
for access connecetion strings
https://www.connectionstrings.com/access/

installing database engine without admin rights

I have a project with vb-2013 and my database is access 2013.
When I run my project on another computer this error appears:
Microsoft.ACE.OLEDB.12.0 provider is not registered on the local
machine error
Is there a way to install a Microsoft database engine without admin rights because of security policies
or
adding any dll file to my project to run it without installing Microsoft database engine.
Not to my knowledge, no. All ODBC and OLE-DB driver binary registrations are handled by systemwide controls. ODBC does allow for per-user connection settings, it still requires systemwide binary installation. If you're writing a "portable" (installation-free) application I recommmend using Sqlite instead.
As an aside, there are very few reasons to use JET Red (MS Access) today over actively-developed systems like Sqlite considering how limited the tooling is, and how SQL implementation is non-standard (e.g. it doesn't support COALESCE and it also requires a parenthesis pair around every JOIN) .

Is ODAC must for C# Oracle Database connectivity using ODP.net

I am new to Databases and .net!
I have SQL developer 3.0 installed through which I can connect to the Oracle 11g Database server.
The requirement is to write a C# program to connect to the oracle database and run query; in my visual studio 2013 project I have added a reference to Oracle.DataAccess.Client and written the code, however while debugging an error occurs that says "Ora-12541:TNS:No-Listener".
My question for now is, Do I need to install an Oracle client (64-bit ODAC 11.2 Release 6 (11.2.0.4.0) Xcopy for Windows x64 ?), my assumption was SQL developer will take care of this!
Please help!
SQL Developer has it's own Oracle drivers (JDBC as far as I know), thus you must install Oracle Client in order to connect to an Oracle DB in Visual Studio.
Note, "ODAC" contains only the ODP.NET Data Provider (i.e. mainly the Oracle.DataAccess.dll file). In order to use it, you must install the actual Oracle Client - at least the Instant Client (which is also included in the ODAC Download file).
Consider to use the ODP.NET Managed Driver, then you need only one single DLL, nothing else. It can be downloaded from Oracle page 64-bit Oracle Data Access Components (ODAC) Downloads and works for both 32bit and 64bit applications.
Unless you copied Oracle.DataAccess.dll from another machine, all oracle packages that include it, also include some version of the client. ODAC includes the full version while the xcopy installs have the instant client. I'll also point to the managed provider though for simplicity as it does not have any unmanaged dependencies,
However, if you got all the way to an "ora-xxxxx" error, it sounds like your Oracle client is correctly installed. The only issue you have now is your connection string. If you normally use a TNS name in Sql Developer, than you either need to copy your existing tnsnames.ora to network/admin in your new oracle home dir, or you need to set a TNS_ADMIN system environment variable to point to your existing one. There are other options too, but your error in this case is tns specific.

Alternative to Microsoft.Jet.OLEDB.4.0 for 64 bit access on MDB File

I have like many others the problem that I can't access Microsoft Access (MDB Files) from my 64 bit machine using Microsoft.Jet.OLEDB.4.0.
I know that there's no 64bit version of it, and that I need to compile it against x86.
So my question is:
Do you know any other .NET Providers for Microsoft Access that supports 64bit access?
To get 64 bit Microsoft Access drivers download the Microsoft Access Database Engine 2010 Redistributable. You cannot install that with a 32 bit version of Microsoft Office installed.
The ODBC connection string with that driver is "Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};Dbq=%FILE_NAME%;Uid=Admin;Pwd=;". The OleDb connection string for that driver is "Provider=Microsoft Office 12.0 Access Database Engine OLE DB Provider;Data Source=%FILE_NAME%;User Id=admin;Password=;.
For Windows server 2003, there is the MSDASQL that offer an OLEDB provider for ODBC, which can connect to Access. It is available in 64bits.

Best way to connect to Interbase 7.1 using .NET C#

Could someone please explain the best way to connect to an Interbase 7.1 database using .NET/C#?
The application will be installed on many end user computers so the less "add-ons" that I will have to package with my application the better.
CodeGear offers a free ADO.NET 2.0 driver for registered users of InterBase here:
http://cc.embarcadero.com/item/25497
Note that "registered users of InterBase" includes the free InterBase 2007 Developers Edition. The download says that it's for 2007, but it works fine with InterBase 7, and the InterBase team at CodeGear has told me that they have no problem with people using it for that purpose.
I do not recommend using a driver designed for Firebird, as InterBase and Firebird have somewhat different SQL syntaxes, and differ in other features, as well. In particular, I think that using any driver dependent on fbclient.dll with InterBase is outright dangerous.
Check this providers:
Interbase and Firebird Developer's for Visual Studio .Net
Firebird .NET Data Provider
FireBird - InterBase .NET (Mono) Providers
I think the Firebird .net provider is the same as the one that's in mono. Both are excelent btw.
The code in the help file works in many situations but not all, especially on Windows 8.1, Windows Server 2012 machines.
Make sure you get the latest InterBase_ADO.NET from embarcadero. The version I updated to was version 16.0.4327.44959 of Borland.Data.AdoDbxClient.dll. (Right click on file, properties, details to see version number). The install also creates a x64 version folder for 64bit even though I did not use it. I targeted x86 with no issues.
This ADO.NET install is not necessary to do on every machine – you just need to include the below files in your project and have Interbase installed on the machine you are running on. I only installed the driver on my development computer.
The install will extract all the necessary files you need to put in you application to connect to the database. It will also create the readme ADO_NET 2_0 Driver for InterBase XE Installation and Usage Instructions.htm file. IMPORTANT NOTE: the DB connection examples in this help htm file do not work 100% of the time. See my code example below for the solution.
No ODBC connection necessary. The list of the files to be included in your .NET project and to be copied local are:
Borland.Data.AdoDbxClient.dll
Borland.Data.DbxCommonDriver.dll
Borland.Data.DBXInterBaseDriver.dll
Borland.Delphi.dll
Borland.VclDbRtl.dll
Borland.VclRtl.dll
dbxadapter.dll (x86 or x64 version)
dbxint.dll (x86 or x64 version)
gds32.dll (from the interbase DB install)
interbase.msg (from the interbase DB install)
I found two connection strings that worked. To connect use one of two connection string:
connectionstring1 = "DriverName=Interbase;Database=" + database + ";User_Name=" + userid + ";Password=" + password;
connectionstring1 = connectionstring1 + ";SQLDialect=3;MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommandFactory,Borland.Data.DbxReadOnlyMetaData,Version=11.0.5000.0,Culture=neutral,";
connectionstring1 = connectionstring1 + "PublicKeyToken=91d62ebb5b0d1b1b;GetDriverFunc=getSQLDriverINTERBASE;LibraryName=dbxint30.dll;VendorLib=GDS32.DLL";
connectionstring2 = “User_Name="+userid+";Password="+password+";Database="+database+";ServerType=0;Charset=NONE;LibraryName=.\\dbxint.dll;VendorLib=GDS32.DLL;GetDriverFunc=getSQLDriverINTERBASE;SQLDialect=3";
GlobalObjects.dbconn = (TAdoDbxConnection)TAdoDbxInterBaseProviderFactory.Instance.CreateConnection();
GlobalObjects.database = databasepath;
GlobalObjects.dbconn.ConnectionString = connectionstring1; //or connectionstring2
GlobalObjects.dbconn.Open();

Categories