Thanx Andrew

it does the trick :)


Thanx and Regards

Naresh Chandak



----- Original Message ----- 
From: "Andrew Pahomov" <[EMAIL PROTECTED]>
To: "SAPDB news (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 2:18 PM
Subject: RE: Problem with Executing Procedure


> Hello Naresh!
> 
> This is a quick and dirty solution for obtain ResultSet via jdbc:
> 
>  1. Create SP like in Anhaus sample:
> 
> CREATE DBPROCEDURE TEST_PROC RETURNS CURSOR AS
> BEGIN
> SET $CURSOR = 'MYCURSOR';
> DECLARE :$CURSOR CURSOR FOR SELECT * FROM SYSDBA.DUAL;
> END ;
> 
> 2. Make some dirty changes in
> com.sap.dbtech.jdbc.CallableStatementSapDB.java in 342 rows change
>             if ((functionCode == FunctionCode.Select_FC)
>                 || (functionCode == FunctionCode.Show_FC)
>                 || (functionCode == FunctionCode.Explain_FC)){
> on
>             if ((functionCode == FunctionCode.Select_FC)
>                 || (functionCode == FunctionCode.Show_FC)
>                 || (functionCode == FunctionCode.Explain_FC)
>                 || (functionCode == FunctionCode.DBProcExecute_FC)) {
> 
> and after that launch sample java application like
> 
> package test_jdbc;
> 
> import java.sql.*;
> 
> public class Test {
> 
>   private static Connection fConnection;
>   private static String fResult = null;
> 
>   public Test()
>   {
>   }
> 
>   public static void login()
>          throws SQLException
>   {
> /
>     DriverManager.registerDriver(new com.sap.dbtech.jdbc.DriverSapDB());
>     fConnection =
>     DriverManager.getConnection ("jdbc:sapdb://yourhost/yourDB",
>                                  "user", "password");
> 
>   }
> 
> 
> public static void main(String args[])
> {
>  try{
>   login();
>   CallableStatement stmt = fConnection.prepareCall ("call test_proc");
>   stmt.execute();
>   ResultSet rset = stmt.getResultSet();
>   rset.next();
>   fResult = rset.getString(1);
>   System.out.println(fResult);
>   }
>   catch (Exception e)
>   {
>     e.printStackTrace();
>   }
> }
> }
> 
> Looking forward to your reply,
> With respect,
> Andrew Pahomov
> Software Developer
> Validio Software, Ukraine
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to