Skip to main content

I am trying to connect with MS SQL Server using acuSql but I get:
SQLCODE -1
SQLSTATE 08001

01 servername pic x(30) value "(LocalDb)\\MSSQLLocalDB".

01 userid         pic x(20) value "PCANDRE\\andre".


EXEC SQL CONNECT TO :servername as C1
USER :userid USING :passwd

also tried withoud userid.

Configuration: ACUSQL_RUNTIME_DLL asqlsrvr.dll

However this works: sqlcmd -S (LocalDb)\\MSSQLLocalDB

I am trying to connect with MS SQL Server using acuSql but I get:
SQLCODE -1
SQLSTATE 08001

01 servername pic x(30) value "(LocalDb)\\MSSQLLocalDB".

01 userid         pic x(20) value "PCANDRE\\andre".


EXEC SQL CONNECT TO :servername as C1
USER :userid USING :passwd

also tried withoud userid.

Configuration: ACUSQL_RUNTIME_DLL asqlsrvr.dll

However this works: sqlcmd -S (LocalDb)\\MSSQLLocalDB

In working-storage is your passwd field something like this:

01 passwd.
49 passwd-length PIC s9(4) comp-5 value 0.
49 passwd-name PIC x(18).


In working-storage is your passwd field something like this:

01 passwd.
49 passwd-length PIC s9(4) comp-5 value 0.
49 passwd-name PIC x(18).

Yes I am using the sample program from MF.


Yes I am using the sample program from MF.

To use Windows authentication when connecting to SQL Server with AcuSQL, omit the USER and USING phrases.


To use Windows authentication when connecting to SQL Server with AcuSQL, omit the USER and USING phrases.

I also tried that but no result.


I also tried that but no result.

did you compile using -pk

and

Windows:

The new runtime DLL is named asqlsrvr.dll. You can use this DLL in two ways:

  • Rename the DLL to esqllib.dll for the runtime to use this DLL when attempting to execute any AcuSQL commands.
  • Give the DLL a name of your choice, and set the configuration variable ACUSQL_RUNTIME_DLL to the name you have chosen. Keep the name as asqlsrvr.dll and setting ACUSQL_RUNTIME_DLL to asqlsrvr.dll.

I also tried that but no result.

What does a trace show? - portal.microfocus.com/.../KM000005044


What does a trace show? - portal.microfocus.com/.../KM000005044

My compile command: "C:\\Program Files (x86)\\Micro Focus\\extend 10.4.1\\AcuGT\\bin\\ccbl32"  -Ps -Pk MSSQL testsql.cbl

community.microfocus.com/.../runtime.log


My compile command: "C:\\Program Files (x86)\\Micro Focus\\extend 10.4.1\\AcuGT\\bin\\ccbl32"  -Ps -Pk MSSQL testsql.cbl

community.microfocus.com/.../runtime.log

I see in the log ODBC SQL Server Driver  - instead of using the servername LocalDb)\\MSSQLLocalDB  can you use ODBC Administrator and set up a DSN using the SQL Server driver, then use that DSN name in your COBOL program.


My compile command: "C:\\Program Files (x86)\\Micro Focus\\extend 10.4.1\\AcuGT\\bin\\ccbl32"  -Ps -Pk MSSQL testsql.cbl

community.microfocus.com/.../runtime.log

>> [Microsoft][ODBC SQL Server Driver][DBNETLIB]De SQL Server bestaat niet of de toegang tot de server is geweigerd.

Looks like this is the issue. Can you try setting the IP address or Hostname of the machine where SQL Server is running in the data item 'servername'. If it's running on the same machine where you are running the COBOL program then use '127.0.0.1'.


>> [Microsoft][ODBC SQL Server Driver][DBNETLIB]De SQL Server bestaat niet of de toegang tot de server is geweigerd.

Looks like this is the issue. Can you try setting the IP address or Hostname of the machine where SQL Server is running in the data item 'servername'. If it's running on the same machine where you are running the COBOL program then use '127.0.0.1'.

"When connecting to a server, the runtime DLL for the AcuSQL interface to SQL Server environments takes the name of the server, not the name of a datasource." - www.microfocus.com/.../GUID-40B55B06-A462-4111-909A-406D29A23FD3.html


"When connecting to a server, the runtime DLL for the AcuSQL interface to SQL Server environments takes the name of the server, not the name of a datasource." - www.microfocus.com/.../GUID-40B55B06-A462-4111-909A-406D29A23FD3.html

Solved:

Uninstalled SQL Server Management Studio

Installed SQL Server 2019 Express

(Re)installed SQL Server Management Studio

Servername: localhost\\SQLEXPRESS

Due to lack of my knowledge of SQL I didn't install SQL Server Express first but thanks for your help.