This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can not connect to MS SQL Server

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

Parents
  • 0

    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).

    SW Engineering(QA)  

    Although I am an OpenText employee, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0 in reply to 

    Yes I am using the sample program from MF.

  • Suggested Answer

    0   in reply to 

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

    ---

    Martin Turner

    Senior Technical Support Engineer

    Rocket Software

  • 0 in reply to   

    I also tried that but no result.

  • 0   in reply to 

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

    ---

    Martin Turner

    Senior Technical Support Engineer

    Rocket Software

  • 0 in reply to   

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

    Runtime version 10.4.1
    Data Execution Prevention is Enabled
    Configuration file = 'sd.ini'
    Set parameter 'ACUSQL_RUNTIME_DLL' to 'asqlsrvr.dll'
    Set parameter 'FILE_PREFIX' to 'C:\asof\data\Mdk'
    Set parameter 'CODE_PREFIX' to 'C:\Asof\objects'
    Set parameter 'CODE_SUFFIX' to 'ACO'
    Try loading 'C:\Asof\objects\testsql.ACO'...
    C:\Asof\objects\testsql.ACO loaded
    20:03:04.172000 ESQL_Initialize
    20:03:04.172000 Leaving
    20:03:04.172000 ESQL_CBL_Dispatch
    20:03:04.172000  sql_start
    20:03:04.172000   name: SQL$START
    20:03:04.172000   nargs: 0
    20:03:04.172000   Arguments:
    20:03:04.172000   initial: 0
    20:03:04.172000  Leaving, sqlca reset
    20:03:04.172000 Leaving
    20:03:04.172000 ESQL_CBL_Dispatch
    20:03:04.172000  sql_connect
    20:03:04.172000   name: SQL$CONNECT
    20:03:04.172000   nargs: 2
    20:03:04.172000   Arguments:
    20:03:04.172000   Arg 0: Addr: 0317F1D0, length: 38, type: 16, digits: 0, scale: 0
    20:03:04.172000 (0) >>>  284c 6f63 616c 4462    295c 4d53 5351 4c4c    (LocalDb )\MSSQLL
    20:03:04.172000 (0) >>>  6f63 616c 4442 2020    2020 2020 2020 2020    ocalDB           
    20:03:04.172000 (0) >>>  2020 2020 2020                                      
    20:03:04.172000   Arg 1: Addr: 00770604, length: 2, type: 16, digits: 0, scale: 0
    20:03:04.172000 (1) >>>  4331                                          C1
    20:03:04.172000   initial: 0
    20:03:04.172000   server: '(LocalDb)\MSSQLLocalDB', connection name: 'C1'
    20:03:20.862000   report_error called from 2105
    20:03:20.862000    [1] 08001 17
    20:03:20.862000  - [Microsoft][ODBC SQL Server Driver][DBNETLIB]De SQL Server bestaat niet of de toegang tot de server is geweigerd.
    20:03:20.862000    [2] 01000 53
    20:03:20.862000  - [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
    20:03:20.862000   No more messages
    20:03:20.862000   commit_or_rollback_transaction: 0
    20:03:20.862000    report_error called from 1616
    20:03:20.865000     [1] 08003 0
    20:03:20.865000  - [Microsoft][ODBC-stuurprogrammabeheer] De verbinding is niet geopend
    20:03:20.865000    No more messages
    20:03:20.865000   Leaving
    20:03:20.866000  Leaving
    20:03:20.873000  ESQL_CBL_Dispatch
    20:03:20.873000   sql_start
    20:03:20.873000    name: SQL$START
    20:03:20.873000    nargs: 0
    20:03:20.873000    Arguments:
    20:03:20.873000    initial: 0
    20:03:20.873000   Leaving, sqlca reset
    20:03:20.873000  Leaving
    20:03:20.873000  ESQL_CBL_Dispatch
    20:03:20.873000   sql_disconnect_all
    20:03:20.873000    name: SQL$DISCONNECTALL
    20:03:20.873000    nargs: 0
    20:03:20.873000    Arguments:
    20:03:20.873000    initial: 0
    20:03:20.873000   Leaving
    20:03:20.873000  Leaving
    20:03:20.873000  mssql_commit
    20:03:20.873000   Not in a transaction
    20:03:20.873000  Leaving
    20:03:20.891000  mssql_rollback
    20:03:20.891000   Not in a transaction
    20:03:20.891000  Leaving
    20:03:20.891000 transaction system shutdown
    20:03:20.891000  mssql_exit
    20:03:20.891000   Cursors: 0, 0
    20:03:20.891000   A68: 'nil'
    20:03:20.891000   A2
    20:03:20.891000   0 = SQLFreeHandle(1, 027104D0)
    20:03:20.891000  Leaving
    20:03:20.891000 In rmfm_exit
    20:03:20.891000 In rmfm_rexit
    

  • 0 in reply to 

    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.

    SW Engineering(QA)  

    Although I am an OpenText employee, I am speaking for myself and not for OpenText.
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • Suggested Answer

    0   in reply to 

    >> [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'.

    ---

    Martin Turner

    Senior Technical Support Engineer

    Rocket Software

  • 0   in reply to   

    "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

    ---

    Martin Turner

    Senior Technical Support Engineer

    Rocket Software

Reply Children
  • 0 in reply to   

    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.