Piyush aggarwal
Piyush aggarwal

Reputation: 772

Unable to access DBCONN after migration to EHP7

I want to access Unix Database from my SAP system. I was using cl_sql_connection class to open the connection. This class was working fine before the upgrade to EHP7. But, now, I am unable to Access table DBCONN in any Stabdard SAP transaction (SE16, SE11...)

Following is my code, returning exception since EPH7 upgrade.

   * Fetch data from the ACMM application, using db-links.

        TRY.
        CALL METHOD cl_sql_connection=>get_connection
          EXPORTING
            con_name = lw_dbcon_name
          RECEIVING
            con_ref  = lo_sql_connection.

      CATCH cx_sql_exception .
 =>An exception occurred while opening SQL Connection 
    ENDTRY.

Is their any other way through which i can connect to other Server?

Upvotes: 1

Views: 737

Answers (1)

Mikael G
Mikael G

Reputation: 742

Yes, there is. You can use the (older) variant of EXEC SQL.

But before you do, check the connection using ADBC_TEST_CONNECTION in SE38.

You could also get some more details by exploring the exception object you have. Here is how I usually do it:

TRY.
EXEC SQL.
  CONNECT TO 'ZUNIXDB_DBCON'
ENDEXEC.
EXEC SQL.
  OPEN dbcur FOR
    SELECT id FROM table
ENDEXEC.
CATCH cx_sy_native_sql_error INTO lr_cx_native_sql_error.

Now you have info like:

lr_cx_native_sql_error->get_text( )
lr_cx_native_sql_error->get_longtext( )
lr_cx_native_sql_error->sqlmsg

Upvotes: 2

Related Questions