Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use an ADO.NET library in C++ to read Oracle DB?

Apologies if this is a bit of a vague question; I'll try to word it as appropriately as I can.

Basically I have a C++ application that currently runs off of a back-end MSSQL (SQL Server 2014) database. To ease in database communication and building the entity model we assembled our own set of C++ classes that wrap up the native ADO.NET calls; we have created it in such a way that the developer simply needs to supply details for a connection string and it is assembled as part of the connection method like so:

string.Format(_T("DRIVER=SQL Server;SERVER=%s\\%s;UID=%s;PWD=%s;DATABASE=%s"),string,strConnInstance,strUser,strPassword,strDatabase);

We now have a requirement to read from an oracle database, and we wonder if we can use the same connection libraries. I assume that we will need to tweak the connection string (e.e.g the driver would need to read something different). I believe I have read that Oracle connection can be faciliated through use of an ODBC driver? Would it simply be a case of installing the relevant driver (if so, which?) and changing the "Driver" argument in the connection string (if so, to what?).

If it is not quite this simple, is there any other way it can be done, or are we looking at a redevelopment?

Thanks in advance!

like image 840
Raiden616 Avatar asked Sep 27 '22 08:09

Raiden616


1 Answers

The answer is yes you can use ADO.NET to connect to Oracle. There's plenty of people out there on stack overflow already doing it...

https://stackoverflow.com/search?q=oracle+ado.net

Oracle has a page for the db provider...

http://www.oracle.com/technetwork/topics/dotnet/index-085163.html

Microsoft has a page talking about it...

https://msdn.microsoft.com/en-us/library/77d8yct7(v=vs.110).aspx

Oracle even has examples using Entity Framework...

http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51odt-453447.html

There's heaps of resources out there.

like image 86
Mick Avatar answered Oct 30 '22 02:10

Mick