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: 

db connect on BW which is on unix for sql server

Former Member
0 Kudos
112

Dear Experts,

I need to dbconnect SQL server database from SAP BW(which is on Unix and Oracle).

As I know,I need to install dbsl for unix(dbmssslib.sl)

But I don't know how to install sql server client on unix server.

I search the SDN,Found that----"You need to install the BI java connectors.

Relational DB's: you need to install the BI JDBC connector ,once u r done with it you should be able to connect any rdbms.

"

Is it right ?

Anybody help me on this.

Thanks a lot

thomas

1 REPLY 1

Former Member
0 Kudos
43

Hi

Connecting to an External database from SAP

Step 1: Create an entry for the External database in DBCON table using Trxn: DBCA.

Table: DBCON (Description of Database Connections)

Field Name Description Value (For: E.g.:)

CON_NAME Logical name for a RAJ

database connection

DBMS Database system MSS

USER_NAME Database user <username>

PASSWORD Password for setting up <pwd>/<pwd>

the connection to the database

CON_ENV Database-specific information MSSQL_SERVER=depotserver MSSQL_DBNAME=HOF_INDORE

DB_RECO Availability type for an open database connect

Step 2: Now you can write code to connect to the external database…

Your Sample code can be something like this……

FUNCTION-POOL z_houston. "MESSAGE-ID ..

DATA: BEGIN OF wa,

c_locid(3),

c_locname(50),

c_locstate(5),

END OF wa.

FUNCTION z_houston_connect.

*"----


""Local interface:

*"----


EXEC SQL.

CONNECT TO 'RAJ' AS 'V'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'V'

ENDEXEC.

*- Get the data from MS-SQL Server

EXEC SQL.

open C1 for

select

loc_id,

loc_name,

loc_state

from ho_loc_mast

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 into :wa-c_locid, :wa-c_locname, :wa-c_locstate

ENDEXEC.

IF sy-subrc = 0.

PERFORM loop_output.

ELSE.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE C1

ENDEXEC.

ENDFUNCTION.

&----


*& Form LOOP_OUTPUT

&----


  • Output

----


FORM loop_output .

WRITE: /5 wa-c_locid, 10 wa-c_locname, 65 wa-c_locstate.

CLEAR wa.

ENDFORM. " LOOP_OUTPUT

Regards

Raj