Highlighted
Absent Member.
Absent Member.
3765 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
17 Replies
Highlighted
Absent Member.
Absent Member.

I get MFSQLMESSAGETEX = Could not make connection.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

I tested this with VC2.3 PE and it also worked for me. Since the OpenESQL Assistant can connect using this DSN it makes no sense that you cannot connect using the application.

I would like you to turn on ODBC tracing to see if it will give us any additional info.

From the SQL tab on the properties page please add the directive ODBCTRACE and set the option to always and then run it again.

This should generate the file MFSQLTRACE.LOG in the current directory.

Can you attach this to the post or copy and paste its contents?

0 Likes
Highlighted
Absent Member.
Absent Member.

Is there a way to get this to you in a formatted form?

SQLProject      3e58-3cd4 ENTER SQLAllocEnv

HENV *              0x0073FCD8

SQLProject      3e58-3cd4 EXIT  SQLAllocEnv  with return code 0 (SQL_SUCCESS)

HENV *              0x0073FCD8 ( 0x00F07C90)

SQLProject      3e58-3cd4 ENTER SQLAllocConnect

HENV                0x00F07C90

HDBC *              0x0072B12C

SQLProject      3e58-3cd4 EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)

HENV                0x00F07C90

HDBC *              0x0072B12C ( 0x00F07D10)

SQLProject      3e58-3cd4 ENTER SQLDataSourcesW

HENV                0x00F07C90

UWORD                        2 <SQL_FETCH_FIRST>

WCHAR *             0x00F004C0

SWORD                       32

SWORD *             0x0072B10C

WCHAR *             0x00F08058

SWORD                      256

SWORD *             0x0072B108

SQLProject      3e58-3cd4 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)

HENV                0x00F07C90

UWORD                        2 <SQL_FETCH_FIRST>

WCHAR *             0x00F004C0 [      18] "MS Access Database"

SWORD                       32

SWORD *             0x0072B10C (18)

WCHAR *             0x00F08058 [      40] "Microsoft Access Driver (*.mdb, *.accdb)"

SWORD                      256

SWORD *             0x0072B108 (40)

SQLProject      3e58-3cd4 ENTER SQLDataSourcesW

HENV                0x00F07C90

UWORD                        1 <SQL_FETCH_NEXT>

WCHAR *             0x00F004C0

SWORD                       32

SWORD *             0x0072B10C

WCHAR *             0x00F08058

SWORD                      256

SWORD *             0x0072B108

SQLProject      3e58-3cd4 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)

HENV                0x00F07C90

UWORD                        1 <SQL_FETCH_NEXT>

WCHAR *             0x00F004C0 [       8] "Library "

SWORD                       32

SWORD *             0x0072B10C (8)

WCHAR *             0x00F08058 [      31] "Microsoft Access Driver (*.mdb)"

SWORD                      256

SWORD *             0x0072B108 (31)

SQLProject      3e58-3cd4 ENTER SQLDataSourcesW

HENV                0x00F07C90

UWORD                        1 <SQL_FETCH_NEXT>

WCHAR *             0x00F004C0

SWORD                       32

SWORD *             0x0072B10C

WCHAR *             0x00F08058

SWORD                      256

SWORD *             0x0072B108

SQLProject      3e58-3cd4 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)

HENV                0x00F07C90

UWORD                        1 <SQL_FETCH_NEXT>

WCHAR *             0x00F004C0 [       7] "Library"

SWORD                       32

SWORD *             0x0072B10C (7)

WCHAR *             0x00F08058 [      31] "Microsoft Access Driver (*.mdb)"

SWORD                      256

SWORD *             0x0072B108 (31)

SQLProject      3e58-3cd4 ENTER SQLSetConnectOption

HDBC                0x00F07D10

SQLINTEGER                 110 <SQL_ODBC_CURSORS>

SQLPOINTER                 0 <SQL_CUR_USE_IF_NEEDED>

SQLProject      3e58-3cd4 EXIT  SQLSetConnectOption  with return code 0 (SQL_SUCCESS)

HDBC                0x00F07D10

SQLINTEGER                 110 <SQL_ODBC_CURSORS>

SQLPOINTER                 0 <SQL_CUR_USE_IF_NEEDED>

SQLProject      3e58-3cd4 ENTER SQLDriverConnectW

HDBC                0x00F07D10

HWND                0x00010010

WCHAR *             0x56FC2220 [      -3] "******\ 0"

SWORD                       -3

WCHAR *             0x56FC2220

SWORD                       -3

SWORD *             0x00000000

UWORD                        0 <SQL_DRIVER_NOPROMPT>

SQLProject      3e58-3cd4 EXIT  SQLDriverConnectW  with return code 100 (SQL_NO_DATA_FOUND)

HDBC                0x00F07D10

HWND                0x00010010

WCHAR *             0x56FC2220 [      -3] "******\ 0"

SWORD                       -3

WCHAR *             0x56FC2220

SWORD                       -3

SWORD *             0x00000000

UWORD                        0 <SQL_DRIVER_NOPROMPT>

SQLProject      3e58-3cd4 ENTER SQLFreeConnect

HDBC                0x00F07D10

SQLProject      3e58-3cd4 EXIT  SQLFreeConnect  with return code 0 (SQL_SUCCESS)

HDBC                0x00F07D10

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

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.

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
Highlighted
Absent Member.
Absent Member.

Chris,

Problem Solved! The above solution worked. I am now getting output from the program.  Your help is appreciated!

Thanks - John

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.