Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DBCO Connection in ABAP program

Former Member
0 Likes
2,731

Dear all,

I have a test program in production to connect to the DBCO. It connects successfully but failed occasionally. Mean, every few minutes, the connection will become fail! Anyone of u have idea why this happened and how to resolve this? Thank you very much.

I have been tested my test program and the standard ADBC_TEST_CONNECTION at the same time. Sometimes, both are success. Sometimes, when the latter showed success connection, the former will be failed.

Thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
1,214

Catch the CX_SY_NATIVE_SQL_ERROR exception to get to know the error message. If you are already doing so, provide the error messages ( short and long messages ) when it fails.


Data: DB_EXCEP TYPE REF TO CX_SY_NATIVE_SQL_ERROR.
*-Connect Native DB
  CLEAR: DB_CON_STATUS.
  TRY.
      EXEC SQL.
        connect to :db_name as :sy-uname
      ENDEXEC.

      IF sy-subrc EQ 0.
        db_con_status = 'X'.
      ENDIF.

    CATCH cx_sy_native_sql_error INTO db_excep.
      clear e_dbmsg.
      CALL METHOD db_excep->if_message~get_text
        RECEIVING
          result = e_dbmsg.

      CLEAR: e_dbmsg_long.
      CALL METHOD db_excep->if_message~get_longtext
        RECEIVING
          result = e_dbmsg_long.          

    CLEANUP.
      Clear: db_name, e_dbname.
  ENDTRY.

Edited by: Suman Jagu on Nov 14, 2011 2:10 PM

Read only

Former Member
0 Likes
1,214

Hi CNHO ,

Use the below threads to solve your issue, i hope it will help you , All the best .

Regards ,

Saravana.S