2009 Aug 13 12:47 PM
Hi,
To pass the data from abap-program to mssql server,i have created database connection through dbco t.code.
now i am trying to get connection thro native sql but am not able to get it .Am working in ECC 5.0.
Could anyone help me on this.Did i miss anything?
i have tried Native-sql like this.
DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
EXEC SQL.
CONNECT TO :con_name AS 'C1'
ENDEXEC.
Thanks in advance.
2009 Aug 19 2:13 PM
Hi,
Trying to do the same here, only using Oracle DB.
....
DATA: dbc TYPE DBCON_NAME VALUE 'BI'
....
TRY.
EXEC SQL.
CONNECT TO :dbc
ENDEXEC.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.
CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
sql_emsg = oref_native_sql_error->get_text( ).
MESSAGE sql_emsg TYPE 'I'.
ENDTRY.
I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
I suggest the same to you..
In the meantime, if anyone can help out, it will be appreciated.
Regards,
SD
Hi,
Trying to do the same here, only using Oracle DB.
....
DATA: dbc TYPE DBCON_NAME VALUE 'BI'
....
TRY.
EXEC SQL.
CONNECT TO :dbc
ENDEXEC.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.
CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
sql_emsg = oref_native_sql_error->get_text( ).
MESSAGE sql_emsg TYPE 'I'.
ENDTRY.
I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
I suggest the same to you..
In the meantime, if anyone can help out, it will be appreciated.
Regards,
SD
2009 Aug 17 8:30 AM
2009 Aug 19 2:13 PM
Hi,
Trying to do the same here, only using Oracle DB.
....
DATA: dbc TYPE DBCON_NAME VALUE 'BI'
....
TRY.
EXEC SQL.
CONNECT TO :dbc
ENDEXEC.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE cx_sy_native_sql_error.
ENDIF.
CATCH cx_sy_native_sql_error INTO oref_native_sql_error.
sql_emsg = oref_native_sql_error->get_text( ).
MESSAGE sql_emsg TYPE 'I'.
ENDTRY.
I keep getting the message 'Native SQL exception has occured' (because of the RAISE statement, I wonder how we can get a meaningfull error description).
Of course this can be a result of a number of network issues, so I'm trying to resolve this together with my BC admin.
I suggest the same to you..
In the meantime, if anyone can help out, it will be appreciated.
Regards,
SD
2009 Sep 18 10:41 AM
2009 Sep 18 11:22 AM
I have solved this, with the help of the BC.
BC needs to make changes to a configuration file, to enable listeners, according to the address and port.
In DBCO, make sure you test your connection (for example: my_dbc) and verify it's working.
In ABAP,
Define my_dbc, like it is, in the post above.
use CONNECT TO :my_dbc, and it should work!
Instead of RAISE exception, use CATCH cx_native_sql_exeption (or something like that, I can't verify at the moment) INTO oref
In CATCH block, use method get_text() of the oref, to fetch the error description into a string variable..then just write it out via list, or message, etc...
Regards
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |