cancel
Showing results for 
Search instead for 
Did you mean: 

Example of WD accessing Stored Procedure...

Former Member
0 Kudos

Hi,

I have 2 requests:

1. Could anyone tell me how I would define a stored procedure within the SAP Java database (I am using a JAVA-only WAS engine)? Do I need to use the appropriate vendor DB tools?

2. Could anyone provide an actual example of a Web Dynpro accessing a Stored Procedure?

Many thanks,

Brian

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Brian,

Here is a code sample, before using it make sure you configure a JDBC connector on the Java AS with the alias defined in the code:



InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup(<JDBC_CONNECTOR_ALIAS>);
Connection conn = ds.getConnection();
// in this case the SP got 2 parameters
CallableStatement cs = connection.prepareCall("{call <SP_NAME>(?,?)}"); 
cs.execute();

It's of course messy and without proper exception handling but you'll manage from here I beleive...

Hope it helps,

Roy