Application Development 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: 

Connection string

Former Member
0 Kudos

Dear ABAPers;

i just have in my application a Z program that connects to SQL database using the following code

DATA: sql(1024)

sql = 'Provider="sqloledb";Data Source="SQL server machine";Initial Catalog="Database name";User Id="admin";Password="password"'.

CALL METHOD OF con 'Open'

EXPORTING #1 = sql.

IF sy-subrc <> 0.

Error = 'No Connection Between SQL Server and SAP'.

ENDIF.

what i want to do is to make this program connects to oracle database, so i changed the code as follows

DATA: oracle(1024)

oracle = 'Provider="OraOLEDB.Oracle";port="1527";Data Source="Oracle server machine";Initial Catalog="database name";User Id="system";Password="123456"'.

CALL METHOD OF con 'Open'

EXPORTING #1 = oracle.

IF sy-subrc <> 0.

Error = 'No Connection Between Oracle Server and SAP'.

ENDIF.

but the problem is that the connection fails, i don't know why.

Regards;

Abdow

2 REPLIES 2

Former Member
0 Kudos

Did you add the connection in tcode DBCO ?

Regards,

Felipe

Former Member
0 Kudos

Hi Ahmed,

Please check whether you had given correct Application Server, System Number, or Client details.

Because you may get connection failed error only when these details are incorrect .Please verify it.

If you want you can refer this forum

[;

Thanks and Regards,

Dhaya.G

Edited by: Dhayalinie Ganesh on Mar 5, 2012 9:36 AM