Accessing a remote database using odbc - visual-c++

I am developing a new tool for my project using mfc to access a rempte database, read the contents and to display in a required format. I am new to programming using mfc. For this, I tried to access a remote database using odbc. For accessing the database I registered the data source in control panel. When I run this application in my system it works fine and I get the result in required format.
Now when I try to open this application from another system I'm getting an error. The application crashes.
Is it possible to make a generic application using odbc api so that the database can be accessed from anywhere without registering it? Or should I use only ole dB for this application.
Thanks in advance.

It's definitely possible to use ODBC to access a remote data source, many ODBC drivers use a wire protocol to talk to a database on another machine. The ODBC API is intended to be generic and abstract your application from the driver, so it is also possible to write a generic ODBC application that can use any ODBC driver. The architecture of ODBC uses a driver manager between the application and the actual ODBC driver to further the abstraction and isolate applications from some specific differences in drivers.
Now, that being said, to connect to a remote data source using ODBC, your ODBC driver must be capable of talking to a remote data source. This will differ based on the ODBC driver, some will be capable and some will only be intended for use with a local source, such as drivers for local files.
With respect to your actual problem, if you could provide details on what driver you're using, how you're making the connection, what the error is, and any other relevant details we may be able to help resolve your issue.

Related

InterBase ODBC driver for Linux

I'm trying to find a free ODBC driver for Linux to connect my application to an Interbase 2017 database. Tried everything I could think of but still luck. Both the server and the client are using a 64-bit based architecture.
I tried a few firebird ODBC drivers. I managed to use them to connect to firebird databases, but they do not work with the newer versions of Interbase.
I managed to connect to the database by using a paid ODBC driver and it is working, but as long the project is personal and not commercial, I prefer to use a free driver.

Connecting to DB2/400 using GCC on Linux-PowerPC

After a lot research, I decided to ask the question here, therefore, I have not found the answer of how I can do this.
I have a system written in C/C ++ which was designed for Linux PowerPC64 BE ( at now, I'm using Debian ) servers, and I need to connect this system to an IBM DB2/400 database, my first choice was to use unixODBC, after searching I saw the need to use a lib. for db2, but I did not find this lib, and then I did not find any other alternatives on how to make that connection.
So, how I can make this connection ?
Linux ODBC drivers for Db2 for IBM i are available in two flavors...
Assuming you have a license for "Client Access", of which the most current incarnation is known as Access Client Solutions (ACS). The Linux ODBC driver is in the Linux Application Package.
IBM also offers a stand-a-lone product, Db2 Connect which provides connectivity to Db2 for Z/OS, DB2 for i, and Db2 for LUW.
For C/C++ you should be good with either. But for instance, the Python Db2 package expects Db2 Connect and doesn't work with the ACS Linux driver.

Linux ARSystem data connection

I deal with an ARSystem and I've been accessing the arserver data by ODBC communication using the AR System driver for Windows plataform. I would like to do the same on a linux plataform. My specifications to do the connection at the ODBC Manager Setup are:
Data Source Name
AR Server
User name
Password
(checked choices)
Replace '.' in object names
Use underscores
Is it possible? How can I do that?
Regards,
I don't believe there is an ARSystem ODBC driver for Linux. You could use an ODBC-ODBC Bridge to get at it from Linux.
Have you considered the JDBC Driver for Remedy or ARSPerl if it has to run in a shell. Both of those solutions can be run on Windows as well.

ODBC RDB 64-bit drivers

I need to get a 64-bit ODBC driver for a Windows 2008 r2 server to connect to an RDB database (v7.2). I downloaded the Oracle ODBC Driver for RDB 3.3.2.0 but I can't get it to connect.
Has anyone used this? Should I be able to connect using this?
The error I get at the moment is
recv() unexpected close ret ) err#0 unknown
I don't see any tnsnames or listener file with this driver are they required?
I've seen this error before and it normally relates to a server side SQL Services error.
Try restarting SQL Services on your VMS box.
There are no tnsnames files etc - you should be able to just setup a 64bit ODBC connection via control panel -> odbc as normal.
In practice though I have found the 64 bit ODBC drivers to be buggy, and have experienced much pain using them. Ditto for the .NET drivers.
(32bit has worked fine though. )
I remember seeing a roadmap from Oracle which stated that they were releasing a new (written from ground up) set of ODBC drivers for RDB 64 bit, so perhaps they do have an underlying issue. I just search for the link, but couldn't find it. If I do come across it again I'll make sure I add it here.
Oracle ODBC Driver for RDB is only for Oracle RDB Database.
Please raise a service request to Oracle Support.

Connect erlang client to oracle

Does anyone know how to connect to oracle from an erlang client in linux? I guess ODBC drivers are required.
According to the Erlang documentation ODBC is the way to go.
There is an Erlang ODBC API which "should run on all Unix dialects including Linux.... But currently it is only tested for Solaris, Windows 2000, Windows XP and NT". Find out more.
There are ODBC drivers for Linux. If you're lucky your distro will already have one installed. Find out more.
==== Answer may be very useful if on Windows, but may contain helpful info for Linux as well =====Now, First of all, we need to download an oracle client or oracle Database itself and install it from here: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html. Oracle installs and creates a folder called oracle (on windows). Inside this folder, you will find its $HOME folder normally: C:\oracle\product\10.2.0\db_1. If you are on windows therefore, when you access the ODBC Configurations by reading this: http://ozinisle.blogspot.com/2011/10/configuring-odbc-connection-for-oracle.html then you will create a new Data Source Name (DSN) of your choice. The steps roughly are as follows: 1. Select System DSN2. Create New Data Source3. Scroll Down to select Oracle in OraDB{Vsn}_home14. Specify the Username (UID), Password5. Note down the Driver name you have selected, Note down the Data Source Name you have entered.6. Test the connection and make sure windows says that its fine.
Now, after this, we go to erlang side. Look at this module, its should kick start you in communicating with oracle.
-module(oracle_client).
-compile(export_all).
-define(CONNECT_OPTIONS,[
{auto_commit,on},
{scrollable_cursors, off}
]).
-define(CONNECT_STRING,"DSN=data_source;UID=uid;PWD=password;DRIVER=Oracle in OraDb10g_home1").connect()->
odbc:start(),
try odbc:connect(?CONNECT_STRING,?CONNECT_OPTIONS) of
{ok,ConnObject} -> {true,ConnObject};
Any -> {error,Any}
catch
E:E2 -> {exception,{E,E2}}
end.
send_sql(ConnObject, SQLQuery)-> odbc:sql_query(ConnObject, SQLQuery).
Erlang ODBC server must be running first. Erlang ODBC will ask you for a connection string and options. In the options first of all note that most Oracle drivers will need those scrollable cursors off. Then, in the connection string, you will be required to enter valid UID (username), password, DSN (Data source name) and the driver name, all these exactly the way you created the DSN in windows ODBC connection in the steps above.That should be okay. Note that you should stick to oracle drivers them selves and avoid third party ODBC Oracle drivers. I have, from experience suffered from using other third party drivers because after say, 10 million connections, the driver starts asking for money/License and blocks your traffic from reaching oracle DB.Let me know in case you get any challenges. The module above is a bit rough, do not use as is because its just a shell testing module, otherwise you will need say a gen_server which will hold the Connection Object so that other processing just keep communicating with it. As long as you are successful in setting up the Data Source Name with the installed Oracle DB or client on your machine, then this module will help you otherwise most challenges are in setting up the ODBC Connection.=== Linux === For Linux, i guess you need to get odbc libraries like Easy Soft ODBC Drivers, or UnixODBC. Then try to set it up as we did with windows above, and then use the Erlang module i have provided above. It should still work. I am afraid i have always connected to oracle from Windows and NOT Linux due to many challenges in setting up and configuring ODBC libraries (give it a shot, you may be succesful in setting up Unix ODBC or Easy Soft ODBC libraries), Otherwise, the Erlang part of it is sorted out.

Resources