Highlighted
Absent Member.
Absent Member.
3734 views

SQL in Tutorial

Jump to solution

I am trying to set up SQL file Library.mdb, starting on page 162 of the VC Tutorial and get error: Data source name not found and no default driver specified   - SQL Error = IM002 -0000019703 when trying to run  a sample program (SimpleAccess.cbl). I am going against C:\cobolclass\datafiles\library.mdb  in C:\COBOLClass\Projects\15_01_SQLProject  when I try to set it up following the directions in the tutorial it seems like the instructions are from a previous version of tools. How cani setup  the DB so it is recognized by the program? I got an mdb viewer and the file looks fine

Thanks.John

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

This format is fine.

I see in the trace file that it is finding a DSN name of "Library " where there is a space after "Library". I am not sure if this is causing the problem or not.

Can you please create a new DSN again using the same Library.mdb file but use a completely different name like "Libconn" and then change the CONNECT in the program to use "Libconn as well?

Thanks.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

Chris,

This solution worked! I am now getting output from the program. Thanks for your help,I appreciate it. Another one solved - John

View solution in original post

0 Likes
17 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

I just tested this here and it worked fine for me and the connect returned sqlcode=0.

Did you use the ODBC Administrator 32-bit to create your DSN?

All I did was start the ODBC Administrator 32-bit:

Go to System DSN tab

Click Add

Select the Microsoft Access Driver (*.mdb) driver

Click Finish

Specify name as Library

click Select button and navigate to C:\COBOLClass\DataFiles and select Library.mdb

Click OK

That was it.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

I followed the instructions above and it appears to have worked. However, when I run the SimpleAccess.cbl pgm again I get error SQL Error = IM001 -0000019703

Could not make connection.  

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

Open up the OpenESQL Assistant from under either the Tools-->Micro Focus menu or the View-->Micro Focus SQL tools menu, depending on the VC version you are using. Does your Library DSN show up in the list of available DSNs? If you click it can you see the two tables defined?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

Only the name Library shows up not Library.mdb.  When I click on it  it goes to the select data source screen and Library shows up there, too,with a description of Patron/ Book DB that I think is correct. But they are not defined. When I use MDB viewer it shows both Patron and Book  as separate entities, though.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

The DSN name is Library so that is what should show up in the list. Library.mdb is the database file that it should point to. If it is prompting for a data source then the Library.mdb file is not set correctly. When it prompts for the data source can you browse to Library.mdb and select it?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

Using the openesql asst I now show book and patron underneath Library, but when I do a query on book and go to results tab it doesn't come out with anything. I don't see a submit button.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

Sorry I found the run query button and it comes back with requested fields. However, when I try to run the program simpleaccessagain it comes back with cannot make connection.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

From the OpenESQL Assistant with the query open please use the Auxiliary Code tab select Connect statement and copy and paste this into your program as a replacement of the connect statement that is already there. Do you still get the error?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

I still get the same error, but i noticed something,the connect sql statement has the connect word in green and the to word is in blue as are other sql statement words, perform, exec sql, cursor,etc. Also, in the statement EXEC SQL INCLUDE SQLCA END-EXEC.include is in green exec sql is in blue. Can it be that these words are not being recognized?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SQL in Tutorial

Jump to solution

What is the actual error message that is returned in the MFSQLMESSAGETEXT variable after the connect?

The coloring you describe is correct. COBOL reserved words are displayed in blue and non-reserved words like CONNECT are displayed in green.

If the words were not recognized you would get a compiler error and not a run-time error like you are experiencing.

Are you using Visual COBOL PE V2.3?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SQL in Tutorial

Jump to solution

i get the error - Could not make connection.

i am using VC PE v2.3

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.