Hi List,

In the example code provided, one of the statement is
int returnCode = rs.getInt("ReturnCode");
This "ReturnCode" inside the getInt() call has to be the name of the field
in the resultset. However, I wish to return values which are not in
resultset. e.g. I wish to return value 1 if block 1 executes, 2 if block 2
executes, and so on. So, how should I make changes?
BTW, I am using SQL Server 7.

Regards,
Rajneesh


----- Original Message -----
From: Franck Rageade <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 05, 2000 6:53 PM
Subject: Re: Calling Stored Procedures in Oracle


Jose,

    it looks like this

<%!
public boolean testCookie(HttpServletRequest request) {
 String cookieCode = getCookieValue(request, "MGR2SECURITY");
 Connection DB;
 CallableStatement cstmt;
 boolean retour = false;
 if (cookieCode!=null) {
  try {
   String DSN = "DB_VO_DEV";

    // Acces a l'interface JDBC
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    // Connection a la base ("jdbc:odbc:" + DSN, login, password)
   if ((request.getServerName()).equals("localhost")) DSN = "DB_VO_DEV" ;
   DB = DriverManager.getConnection("jdbc:odbc:" + DSN, "VO_InternetUser",
"VO_InternetPassword") ;

   // Creation et execution de la requete

   cstmt = DB.prepareCall("{?= call sp_Cookie_Check(?)}");

    // Parametres de sortie
    cstmt.registerOutParameter(1,java.sql.Types.INTEGER);

    // Parametres d'entree
    cstmt.setString(2, cookieCode);

   boolean hasResultSet = cstmt.execute();
   if (hasResultSet) {
    ResultSet rs = cstmt.getResultSet();
    rs.next();
    int returnCode = rs.getInt("ReturnCode");

    if (returnCode == 1) retour = true;
    rs.close();
   }
   cstmt.close();
   DB.close();
  }
  catch (java.lang.Exception ex) {
  }
 }
 return retour;
}

%>

Regards,

    Franck

----- Message d'origine -----
De : "Jose Castro" <[EMAIL PROTECTED]>
� : <[EMAIL PROTECTED]>
Envoy� : vendredi 5 mai 2000 14:45
Objet : Calling Stored Procedures in Oracle


> Does anyone knows if it is possible to call Stored Procedures with JSP's.
>
> I'm using Stored Procedures in Oracle, and some of them return values, but
> another ones don't.
>
> Thanks in advance,
> Jos� Castro
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to