Best way to connect to Interbase 7.1 using .NET C# - 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();

Related

How to find informix datasource in visual studio to connect to

I want to use EF6 with Informix database .
I have searched a lot and find that i can get
EntityFramework.IBM.DB2 6.0.2 from NuGet for Both Informix and DB2 but my main problem is the connection
How to create a connection to my informix database i can't find any provider for .net to use ?
I want to get a window like this :
:
My current window :
Notes:
I use the informix server version : IBM Informix Dynamic Server Version
12.10.FC3
I use the informix client SDK version : 3.50
I use Visual studio 2012
.net framework 4.5
EDIT :according to the recommendations:
I run C:\Windows\SysWOW64\odbcad32.exe
and configure my ODBC but still unable to access the informix DB through V.S :
EDIT2:
According to the recommendation i have installed IBM Informix Software Bundle and able to connect to visual studio through View -->Server Explorer and find all the tables .but still can't find the informix odbc when i try to change the data source through Entity framework like this :
Assuming the CSDK installation was successful, I suspect the 64-bit version of the ODBC Administrator tool is running, while 32-bit IBM drivers were installed. 32-bit drivers will only be visible running the 32-bit version of the ODBC Administrator tool. Microsoft ships both 32- and 64-bit versions in their OS, but the 64-bit version is the one launched from the menus. (See this related question on Super User: https://superuser.com/q/419832).You can run the 32-bit version from a command prompt:
%windir%\SysWOW64\odbcad32.exe
When you go to add your DSN, you should see the IBM drivers, like in the XP screenshot you posted.
Also, make sure you either enter the full path or cd to the %windir%\SysWOW64 directory. Otherwise, you be launching the 64-bit version, which incidentally is also called odbcad32.exe.
EDIT
Visual Studio 2012 is only available as a 32-bit application. 32-bit applications won't see any data sources created with the default 64-bit ODBC Administrator tool.
Two important caveats …
Make sure you are running the 32-bit ODBC Admin tool. If you simply type odbcad32.exe from a command prompt, you will be running the 64-bit version of the tool. Be sure to launch it using the full path: %windir%\SysWOW64\odbcad32.exe.
If your data source is a system DSN, try creating it as a user DSN. There appears to be a problem for users seeing the system DSNs in the server explorer in VS 2012 and VS 2010.
EDIT 2
I've looked back through this and think there is still some missing requirement in your environment. The are quite a few client packages from IBM and you may very well need one of the packages that is more comprehensive than the "IBM Database Add-Ins for Visual Studio".
I would download and install the "IBM Data Server Client" found at http://www-01.ibm.com/support/docview.wss?uid=swg21385217. Per IBM's description …
This is the all in one client package and includes all the client
tools and libraries available. It includes add-ins for Visual Studio.
I was able to download the IBM Data Server Client. Specifically, this is the one I chose.
IBM Data Server Client (Windows AMD 64)
ibm_data_server_client_winx64_V10.5.zip (576 MB)
Since this package was released on 2012-04-30, I would recommend applying the latest fix packs: http://www-01.ibm.com/support/docview.wss?rs=4020&uid=swg27016878
I don't think you want the IBM Informix .NET provider. See "Table 1" in this IBM tech article. The article also walks through connecting to Informix and using the Visual Studio Add-In.
EDIT 5: In order to get the exact same screens you're looking for and to be fully integrated with Visual Studio, with all the bells and whistles you're now demanding, you will need to install IBM Data Server .NET Provider for Informix, which does not have a Developer Edition. You can only get a Trial Version, which requires additional registration information besides that of a regular Developer Registration.
See detailed full information in the link below, including the exact same integration screens between Visual Studio and IBM Informix you're looking for: Get started with the IBM Data Server .NET Provider for Informix
EDIT 4: Code snippet testing the ODBC connection:
private void Form1_Load(object sender, EventArgs e)
{
try
{
string connString = "Dsn=IFMX32;uid=informix";
string cmd = "select * from syschfree";
OdbcConnection conn = new OdbcConnection(connString);
OdbcDataAdapter adapter = new OdbcDataAdapter(cmd, conn);
conn.Open();
DataTable table = new DataTable();
adapter.Fill(table);
dataGridView1.DataSource = table;
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
EDIT 3: I was able to establish an ODBC connection as explained before using the "bundle" package Informix Developer Edition for Windows 32 Version 12.10TC5DE which includes not only the client SDK but also a test server. As you can see in the picture below, i connected to the sysmaster database. Whether or not you need a test server, perhaps you should install this 32-bit bundle package because it may be installing some additional components that would enable you to get connected.
Here some more details on how the connection was configured in the ODBC Data Source Administration tool:
EDIT 2: The 32-bit Client SDK produces the very same results as shown before.
EDIT 1: You may want to give this a try:
Assuming your client SDK is properly installed, then you should be able to see your driver as shown below. In my case, version 4.10 Developer Edition (64-bit).
Then create a User Data Source as below, using your driver and DB information:
And finally, in Visual Studio, your newly created Data Source should be available:
I don't have a server i could use to test this any further, but again, you could give it a try.
Currently the Visual Studio integration and Entity Framework support is only by using IBM DS driver (IBM Data Server Client) which uses DRDA protocol.
The drivers included with Informix Client SDK uses native protocol called SQLI.
You may try after installing IBM DS Driver.
Unfortunately the IBM DS Driver has limited functionality with Informix server.

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.

Access Oracle database from Visual Studio 2008

I need to be able to access Oracle database from Visual Studio 2008(Framework 3.0/3.5). The Database version is 11g.
But I also may need to access older version of this database going back to the year 2007.
I tired to install Oracle database client 11gR2 on my desktop computer which has Windows 7 Enterprise edition.
It did not run from Setup menu but ran from background it seems.
Did notice a folder in C:/Oracle with 2 files sqlnet.ora and TnsNames.ora, but apart from that I noticed in the c:\windows\assembly there was no Oracle.DataAccess components installed.
Which client or tools should I need to install to be able to access versions of Oracle from Visual Studio 2008?
Assuming you suggest there is a client version for each of the Database versions, Can I install one client version on top of the other.
Now that I have installed the client 11gR2 can you tell me if I need to install it, I do not see an uninstaller under my "All Programs" menu .
First of all you need to install ODAC as mentioned in the comment.
Then in your project you need to reference Oracle.DataAccess and in your code you need to include the following
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

SQL Server CE distribution

I have spent several days trying to solve this problem with no luck and my requirements are really simple - I want to make an application with database which will work on most PCs (without DB server installed) and I want to use LINQ. For the compatibility reasons I want to use .NET framework 3.5 (every Windows 7 machine has it).
I have tried 2 ways: SQL Server CE and SQLite.
SQL Server CE
Although Visual Studio does not support LINQ for Compact Version of SQL server, I have found simple workaround - generating .dbml file using metal.exe tool from Visual Studio and then dragging it into project. My application works fine on my machine, but when I copy it somewhere else, it crashes. I have copied all dlls from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\3.5 and tried 4.0 too. I think problem is that my app is not looking for dlls (references) inside its directory. I managed to get it work using DataSets (without LINQ), where I manually add reference to SQLServerCE and check CopyLocal to true. BUT when I use LINQ, there is no reference to SQLServerCE in project references and it is working. I don't know how to change it. Or is there a problem somewhere else?
SQLite
After long messing with SQL Server CE, I have tried SQLite. I am very disappointed how poor is SQLite support in .NET. I had to download older version of ADO.NET provider (newer versions does not add SQLite Database into my Visual Studio 2010 - I don't understand why but I googled that it is normal and I have to install old version and then replace it with newer). Then I downloaded dblinq (I have discovered that this project is dead later) and after some messing with dbmetal and dlls I get rid of errors in Visual Studio and compiled my application. But I can't run it, it always crashes on error 40 - like there was no SQLite server. Of course I have copied all dlls. I can't run it even on my development machine.
I am very surprised that it is nearly impossible to create simple database application in C# .NET which will not bother client with servers etc.
Please is there anyone who made SQL CE work with LINQ and mainly who made his app distributable?
I would suggest you try using the nuget Entity Framework for SQL CE package. It will download all the required assemblies to make it work.
http://nuget.org/packages/EntityFramework.SqlServerCompact/

DMS without installation having Entity Framework driver?

I'm looking for a database system to use with c#. I've mostly used SQL for now, but, this is a small applicaiton I'm gonna to create, which:
-Runs at max 1-2hours each day(so I don't want to have a SQL Server running all the time)
-Will be installed on an usb key(only requirement has to be to have .net 4.0 installed), so it has to be nomade.
What can you advise me? I search a little, but I don't how this kind of database are called.
You can look at the embedded version of Firebird
Firebird have more SQL function than SQLLite which also be a good choice but you can more easily to switch to a full version of the server
The embedded version is an amazing variation of the server. It is a
fully featured Firebird server packed in just a few files. It is very
easy to deploy, since there is no need to install the server. It is
ideal for CDROM catalogs, demos or standalone desktop applications.
Here you can check Entity Framework support
Well, i'd use a file-based "portable" database like:
SQLServer Ce 4.0
Sqlite (I used this provider in the past and it works well, but you have quite a bunch of options).

Categories