Our current DB Connection provider model relies on database connectivity to use DbConnection (System.Data) based objects.
We can connect to DB2 (*Nix * Windows) via OdbcConnection, but we would like to allow the use of native DB2 Drivers.
Is there any way to do so (either .Net framework, OpenSource or (last choice) vendor) without breaking away from our current DAL model?
There is another method not mentioned in the article above, and that is to use DbNetData which simplifies database access and has the ability to connect to DB2 from .NET. The source is hosted on CodePlex below:
DbNetData
Related
Good morning all,
recently I came upon problem with DB connection in Python and C#.
For example, let's say we want to connect SQL Server. In .NET (C#) we just need to know the server name, credentials and we can connect to DB with SqlConnection object. That's clear.
Now, in Python, when using pypyodbc we need to specify driver additionally. And here's come the question:
Why in Python we have to specify driver? We don't have to specify it in C#.
On the other hand, if specifying driver is so crucial, then why don't we have to specify it in C#?
I know, that in C# we have dedicated class for SQL Server (does Python? or pypyodbc is the only choice?), does that mean, that it has some method to resolve which driver to use? Is it the same with Oracle?
I know nothing about python, but I think that should answer your main question:
SqlConnection is designed specifically to work with SQL server, so you don't need to specify the driver, because it uses it's own designated driver.
From SqlConnection.ConnectionString Property page on Microsoft docs:
The ConnectionString is similar to an OLE DB connection string, but is not identical. Unlike OLE DB or ADO, the connection string that is returned is the same as the user-set ConnectionString, minus security information if the Persist Security Info value is set to false (default). The .NET Framework Data Provider for SQL Server does not persist or return the password in a connection string unless you set Persist Security Info to true.
(Emphasis mine, other stuff in the quot are just to provide context.)
And later on down the page:
The .NET Framework Data Provider for SQL Server uses its own protocol to communicate with SQL Server. Therefore, it does not support the use of an ODBC data source name (DSN) when connecting to SQL Server because it does not add an ODBC layer.
(again, emphasis mine.)
When working with other connection classes such as OdbcConnection or OleDbConnection, you need to specify the driver in the connection string.
With Odbc Connection Strings use the keyword Driver,
and with OleDb Connection Strings use the keyword Provider.
About Oracle, The .Net framework have a namespace called System.Data.OracleClient, but it's deprecated (from Oracle and ADO.NET):
The types in System.Data.OracleClient are deprecated. The types remain supported in the current version of.NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.
I'm guessing Oracle's own ADO.Net implementation also works with it's own driver. If you really want to know, you can look it up in their documentation.
I am trying to find out options to connect to a database that is hosted on cloud (Cloud Foundry) and is available as a service. The DB is offered through JDBC driver. I am trying to write a .netcore application (fine with any framework though) to connect to the DB service.
I had referenced the .netcore options and don't find a way to connect to such services. They have provided option to connect to Azure - but, that's a SQL DB. Request for a direction to try out the options:
ODBC - Can I try ODBC - JDBC bridge option?
Oracle Managed Dataservice - Not sure if this can help for the cloud foundry option.
Should I consider moving to .NET Framework instead of .NET Core?
The DB I am trying is a relational DB.
Connecting a C# app to a JDBC (Java) data source requires a bridge of some kind, possibly multiple bridges stacked atop each other. Examples include this, with two API translations (from ADO.NET to JDBC, and from JDBC to DBMS) --
C# ADO.NET app
-> OpenLink Enterprise Edition Generic Client ADO.NET Provider
... TCP/IP ...
-> OpenLink Enterprise Edition Request Broker &
Bridge Agent for JDBC Data Sources
-> JDBC Driver
-- and this, with three API translations (from ADO.NET to ODBC, and ODBC to JDBC, and from JDBC to DBMS) --
C# ADO.NET app
-> OpenLink Lite Edition ADO.NET Provider for ODBC Data Sources
-> OpenLink Lite Edition ODBC Driver for JDBC Data Sources
-> JDBC Driver
These Bridges (Enterprise Edition ADO.NET to JDBC, Lite Edition ADO.NET to ODBC, and Lite Edition ODBC to JDBC) come from my employer, OpenLink Software. There are other options.
We want to allow access to our custom back end data store by pretending to be an ODBC server such as Access or SQL Server. In this way, anyone with those ODBC drivers could connect and send us queries (from anything from asp.net to Excel) which we will resolve on the back end and return a result set.
I have the ability to parse SQL and return result set based on a dynamic sql query. What I don't know is how to pretend to be an ODBC or OLEDB server. I don't even care which server we mimic as long as it's a common one that has drivers that ship with windows.
I have searched but could not find a basic implementation that implements authentication and ExecuteQuery() methods. Does such a .net project exist?
You could implement an ADO.NET data provider?
see http://msdn.microsoft.com/en-us/library/a6cd7c08.aspx
The System.Data.Sqlite project is an excellent example of how to build an ADO.NET data provider for an arbitrary data store.
I have written a Windows Forms application in C#, .NET framework 2.0, that uses System.Data.OleDb to talk to an SQL Server 2000 database, which is working fine. I now need to enhance the application to talk to an DB2 database on AS/400. Is this just a matter of configuring the connection string, or do I need additional driver software (where from) and/or references in my project?
I would like to still use OLEDB, but with DB2.
Edit: I downloaded the Microsoft OLE DB Provider but was unable to install it onto my desktop development PC because I do not have SQL Server installed. This provider seems to be only for integrating SQL Server with DB2, whereas I want to integrate a Windows Forms application with DB2. Is there a different download location for an OLE DB provider that does not require SQL Server, which I can use from a Windows desktop?
You will can use Microsoft's OLEDB for DB2 provider for this. Also the connection string will change.
Like:
Provider=DB2OLEDB;Network Transport Library=TCPIP;Network Address=xxx.xxx.xxx.xxx;Initial Catalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;User ID=myUsername;Password=myPassword;
Or you can use IBM's own IBM OLE DB Provider for DB2 that works without SQL Server.
You should look at Connection strings for IBM DB2 for all other providers and their configuration.
What's the best way to connect to a Informix database from .Net?
I'm developing a client-server application based on a legacy Informix DB which used to be connected by JDBC.
I need it, from the most important to the least:
To be fast
DB server changes not needed
No ODBC and no dependencies, other than de .Net Framework 2.0
Thanks in advance for your help.
The connections strings to use with OleDb or ADO.NET can be found here.
Take a look at this article on how to connect to an Informix database using ADO.NET.
We connect to Informix from .NET, but we do it via web services that are written in FourJ's BDL
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.relnotes.doc/uc3/netrel.htm
See if that helps. Also, what about the built in ODBC or OLEDB drivers? Have you tried those? Those might work.
You might like to investigate OpenLink's Multi-Tier Informix driver for ADO.Net (just install everything on the client): http://uda.openlinksw.com/dotnet/mt/dotnet-informix-mt/