Application Development and Automation 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: 
Read only

ABAP statement for JDBC connection to SQL server

Former Member
0 Likes
1,052

Hi Gurus,

i need to connect a WebDynpro abap to a SQL server.

My OS is Unix so i cannot use a ODBC connection.

Can anyone help me to know if it's possible to write an abap statement to connect the SQL server by JDBC connection?

thanks a lot

Regards

Claudio.

4 REPLIES 4
Read only

Former Member
0 Likes
746

DATA: conn like dbcon-con_name.

conn = 'SRV001'.

EXEC SQL.

connect to :conn

ENDEXEC.

EXEC SQL.

set connection :conn

ENDEXEC.

EXEC SQL.

OPEN C FOR

SELECT * from TBLA

WHERE ....

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C INTO :wa

ENDEXEC.

IF sy-subrc NE 0.

EXIT.

ENDIF.

APPEND wa TO itbl.

ENDDO.

EXEC SQL.

CLOSE C

ENDEXEC.

Read only

Former Member
0 Likes
746

Hi,

ELSEIF SCREEN-GROUP2 = 'PRO'.

clear: list.

if screen-name = 'ZAVBAK-ZZPROMO_ID'.

exec sql.

  • commit

set connection :'CBREPOSITORYPRD'

endexec.

exec sql.

CONNECT TO :'CBREPOSITORYPRD'

endexec.

exec sql.

COMMIT

endexec

EXEC SQL.

OPEN C1 FOR

SELECT CutterRewardsUserListid,

SAPAccountNumber,

PromoID,

FirstName,

LastName

FROM CutterRewardsUserList

WHERE SAPAccountNumber = :XVBPA-KUNNR ORDER BY PromoID

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT C1 INTO :WA5

ENDEXEC.

IF SY-SUBRC = 0.

PERFORM UPDATE_LIST.

ELSE.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE C1

ENDEXEC.

Read only

Former Member
0 Likes
746

Hi,

did you set the JDBC connection in SM59 before to write this code?

thanks

Claudio.

Read only

Former Member
0 Likes
746

hi Sateesh,

i have a system on Unix so i think to miss any libraries for use a DBCO connection.

this is the errore if i try your suggestion:

As well as the standard connection, an attempt was made to set up

another database connection, under the specified ID. The Shared Library

for this second database could not be found.

The Shared Library is usually found in the the Executable

directory (profile parameter DIR_LIBRARY) under the name dbs

<dbs>slib<os_ext>. <dbs> stands for the database type and <os_ext>

stands for the operating system-specific extension of the Shared

Libraries.

The database type is determined from the entry that corresponds to the

specified DB ID in the table DBDCON. Check whether the data in this

entry is correct.

do you have an idea how can i connect by JDBC ?

thanks a lot.