I installed Micro Focus Cobol visual 2010 trial for eclipse (windows 32 bit), I added an application that I want to debug COBOL. But after my EXEC SQL .CONNECT END EXEC and after EXEC SQL INSERT END EXEC, eclipse tells me that as an error: "SQL ERROR 19703 in Connect command and SQL error 10702 in Insert Command". I want to link to a database SQL SERVER 2012 for the application to debug COBOL. I put the directives "SQL(DBMan=ODBC). When I try to put others Directives like INIT, DB or PASS I can´t . I need some others thing like install ODBC Drivers for SQL Server ? When I do that out the Eclipse ednvironment I connected withw SQL Server and I can see my Databases and my tables there.
Thank you for your help.
The 19703 error on the connect simply means that the connect failed which usually indicates that the connect statement is incorrect or the ODBC driver or DSN is not set up properly. The error on the INSERT is due to the failure of the connect.
If you add the following to your program's working-storage:
01 MFSQLMESSAGETEXT PIC X(256).
Then this variable will contain the actual error message text after the error occurs.
Have you setup the DSN using the ODBC Administrator?
You can start this by navigating to Start Menu-->All Programs-->Micro Focus Visual COBOL-->Data Tools-->Data Connections-->ODBC Data Source Administrator 32-bit.
Create a DSN and use its name in the connect statement:
EXEC SQL CONNECT TO MYDSN END-EXEC
After setting up the DSN press the Test Connect button.
If it connects successfully then it should also connect successfully within your COBOL application by using the same DSN.
I am assuming that you are creating a 32-bit DSN because you said that this was a 32-bit Windows system.
You can use the sample program below to test the various connect statements that can be used.
Provide the parameters for DSN, userid and password when prompted.
* Copyright (C) 1992-2002 Micro Focus International Ltd.
* All rights reserved.
* Include the SQL Communications Area. This includes the
* definitions of SQLCODE, etc
EXEC SQL INCLUDE SQLCA END-EXEC
EXEC SQL BEGIN DECLARE SECTION END-EXEC
01 svr pic x(32).
01 usr pic x(32).
01 pass pic x(32).
01 usr-pass pic x(64).
EXEC SQL END DECLARE SECTION END-EXEC.
* Connect to an SQL Server.
display "Connect statement tests"
display " "
display "Enter data source (Eg UserSample2) "
with no advancing
display "Enter username (Eg admin) "
with no advancing
display "Enter password (Eg <blank>) "
*test 1 - basic SQL Server style connect
display "Test 1:"
usr delimited space
"." delimited size
pass delimited space
CONNECT TO :svr USER :usr-pass
if sqlcode not = 0
display "Error: cannot connect "
display "Test 1: OK"
display "Error: cannot disconnect "
*test 2 - SQL Server style connect with no prompt and slash
display "Test 2:"
"/" delimited size
CONNECT TO :svr USER :usr-pass WITH NO PROMPT
display "Test 2: OK"
*test 3 - Oracle style connect with combined user and password
display "Test 3:"
CONNECT :usr-pass USING :svr
display "Test 3: OK"
*test 4 - Oracle style connect with separate user and password
display "Test 4:"
CONNECT :usr IDENTIFIED BY :pass USING :svr
display "Test 4: OK"
*test 5 - Connect with prompt
display "Test 5:"
CONNECT WITH PROMPT
display "Test 5: OK"