Skip to Content
0
Former Member
Mar 04, 2012 at 04:11 PM

Connection string

368 Views

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