DataSource ODBC connection error to PostgreSQL in Visual Studio C# 2010 - c#

we are having a problem connecting to a PostgreSQL database. On one laptop we are using:
64-bit Windows 8
32-bit Visual Studio C# 2010
PostgreSQL version 9.0
64bit ODBC driver for PostgresSQL Unicode(x64) 9.0.1
On one desktop computer we are using:
64-bit Windows 7
32-bit Visual Studio C# 2010
PostgreSQL version 9.4
64bit ODBC driver for PostgresSQL Unicode(x64) 9.0.1
On the laptop, the typed datasets are working fine, but on the desktop, we get an error "Failed to call ODBC driver connection utility" when creating a typed dataset as well as "The specified DSN contains an architecture mismatch between the Driver and Application" depending on whether we use an existing connection string or try to test out a newly created one.
In both cases we are connecting to a machine data source created in ODBC beforehand. The machine data source itself tests successfully and has no problems connecting to PostgreSQL.
We are a bit at a loss as to what would make the difference otherwise than the version of PostgreSQL and what would be the best way to resolve this?
Thanks so much for the help!

Related

Installing MSSQL for Windows 7 and running application made with MSSQL2016 for X86 systems

I'm developing an ERP via Windows Form Application using (C# and SQL) through Visual Studio 2017 and MSSQL SERVER 2016 (VERSION 852) on a 64 bit Machine with Windows 8.
On deploying the application on the X64 machine with SQLLOCALDB (VERSION 852 or above) installed, the application is working fine.
But, I want to distribute the application in my circles having old machines with X86 (32 bit) architecture. The application is getting installed, but on launching the application, the form with DATABASE CONNECTIVITY is creating a problem.
"The database 'MyFirstWFAAPP' cannot be opened because it is version
852. This server supports version 851 and earlier. A downgrade path is not supported. Could not open new database 'MyFirstWFAAPP'. CREATE
DATABASE is aborted. Cannot attach the file
'C:\devx\2018\MyFirstWFAAPP\App_Data\MyFirstWFAAPP.mdf' as database
'MyFirstWFAAPP'. "
PS: Installation of MSSQL SERVER (Local DB) to 32 bit machines, WINDOW 7, has been deprecated by Microsoft (As I've been informed) So, MSSQL SERVER 2016 and above cannot be installed onto Window 7 systems.
Window 7, XP Support SQL SERVER installation either or below SQL SERVER 2008 R2 (VERSION 660/661).
I'm in a dilemma, as I'm have no idea of what to do.
1) Is there any way, we can convert Code of SQL SERVER 2016 to SQL SERVER 2008 (R2) or below??
2) or, should I delete the MSSQL Server 2016 and then install the 2008 editions.
3) or, should I install SQL 2008 on the parallel with SQL SERVER 2016 running. and, also install MSSQL Server Management Studio and choose the targeted versions of MSSQL. (I'm not sure, whether it's possible. Just guessing).
Please support. As, I'm worried.
Thanks and Regards!
Narayan
This has nothing to do with the target platform (x86 vs. x64). This is simply an issue of targeted SQL Server version. SQL Server knows how to upgrade a database file, but there is absolutely no way it can downgrade one. You are distributing a SQL Server 2016 database file (internal version 852), this will only be opened by the SQL Server 2016 or SQL Server 2017.
But the real problem is different. The real problem is that you are distributing the database as an artifact. This is an absolute NO. Just think how will you distribute the next version of your app, your MDF will replace the actual data that was updated by your 'circles'. You must change your application to distribute only scripts for creating and upgrating database. Your framework of choice may well already provide a solution.

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.

Connecting to POSTGRES database using DataSet for Simple Report in C#

I'm using Simple Reports in Visual Studio 2012, c# language, and when I try to connect my data from database using DataSet, I cannot find my postgres database (w/c is 64bit, version 9.3) in creating the connection, using DataSet.
As you can see, there's no postgres data source...
How do I do this?
Thank you.
Wild guess based on insufficient information provided:
Visual Studio 2012 is a 32-bit executable.
You installed the 64-bit PostgreSQL ODBC driver, but not the 32-bit driver.
The ODBC driver must be the same architecture as the application using the driver, not the server. So you need the 32-bit ODBC driver installed.
Download psqlODBC here.

Problems with DSN connection (Win64 app to a 32Bit Postgres Server)

I'm having trouble with the following:
We have a 32bit Postgres Server here in the office.
I'm developing an application in Visual Studio 2013, in a 64bits Windows 8.
When I run the application, I get the following error:
ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
I have both drivers installed (32 and 64 bits) for ODBC, but my 64bits driver, when I try to connect through VS to the server, it throws the same error as above, and only the 32bits driver can connect through VS.
In VS2013,I can see the Tables and configuration of the server, but when I run, more specific, in the Connection.Open() part, the previous exception is thrown.
Can somebody help me?
(Sorry about the English mistakes...)
Most Visual Studio application builds are 32-bit, even when installed on 64-bit Windows.
If your Visual Studio is 32-bit you must use the 32-bit ODBC driver for ODBC communication being done within Visual Studio its self.
You can (and must) still use the 64-bit ODBC driver when doing ODBC communication from 64-bit applications compiled in Visual Studio.
You could also be compiling and running a 32-bit application, even though you're on 64-bit Windows, in which case you must use the 32-bit ODBC driver with it.
Fun, no?

Categories