‎2009 Aug 20 4:01 PM
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.
‎2009 Aug 20 5:24 PM
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.
‎2009 Aug 20 8:23 PM
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.
‎2009 Aug 21 8:46 AM
Hi,
did you set the JDBC connection in SM59 before to write this code?
thanks
Claudio.
‎2009 Aug 21 8:58 AM
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.