Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Net COBOL ODBC

Status
Not open for further replies.

KenBohl

Programmer
Jul 3, 2003
1
0
0
US
Have a working VB ASP application. For reasons of being able to share code between this platform and several batch environments, I want to have an I/O program which is written in COBOL and accesses databases using ODBC.


In the batch environment, I wrote a caller and had no problem. The I/O program refers to a data source name defined in ODBC.Inf. It knows where to find ODBC.Inf by virtue of the @ODBC_INF environment variable.


However, when the VB ASP application calls the same program (in the .Net environment), the COBOL's
"EXEC SQL CONNECT TO 'TAIPROD' END-EXEC"
returns with "Data source name not found and no default driver specified".


Because the same program is connecting in the batch environment, I think it's a fair assumption that the problem is that when the COBOL program is called by the VB ASP program it cannot find ODBC.Inf.


The .Net COBOL help tells how to put
<add key=&quot;@ODBC_INF&quot; value=&quot;C:\ODBC.INF&quot;/>
into Web.Config, but I believe that only an ASP COBOL program will know to look there (I tried putting this information in Web.Config, App.Config, and Machine.Config to no avail).


Any suggestions on
1. how to specify where ODBC.Inf resides
2. how to actually see the process happening - I am really blind-guessing here, all I get is the consistent &quot;Data source name not found and no default driver specified&quot; message on the connect, with no way of knowing if it looked for ODBC.Inf, if it found it, etc.
 
Ken,

First off, ignore the .NET help on that topic. I could never get it to work. However, I did get it to work by doing the following:

1. Create a COBOL85.CBR file in the \bin\debug directory of your application (where your COBOL ODBC executable resides).

2. Add the @ODBC_INF parameter to the CBR file, pointing to the INF file you want. I try to keep them in the same directory.

That's it. You should now be able to access the database (providing your non-.NET environment did).

If not, let me know but this has been the issue whenever I ran into this problem.

Best Wishes!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top