Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / June 2004

Tip: Looking for answers? Try searching our database.

No result set being returned ....

Thread view: 
Raquel - 25 Jun 2004 08:37 GMT
This is a very simple DB2 SQLJ stored procedure. The problem is that it
seems to run fine but returns NOTHING. I mean..as if nothing has
happened..not resultset is returned. I am passing value 'D11' to :workdept
and I have checked in the table that 6 rows should have returned. Any
ideas why no resultset is being returned.

import java.sql.*;
import sqlj.runtime.*;
import sqlj.runtime.ref.*;
import java.io.*;         // Input/Output classes

#sql iterator Sproc3_Iterator(String lname,String fname);
#sql context SpContext;

public class sproc3
{
   public static void sproc3mtd ( String workdept,
                            ResultSet[] rs1 ) throws Exception
   {
    char error = 'n';
       SpContext ctx = new SpContext( "jdbc:default:connection", false
);
    Sproc3_Iterator sproc3_iterator = null;
       // Get connection to the database

    try
     {
       Connection con =
DriverManager.getConnection("jdbc:default:connection");

    #sql [ctx] sproc3_iterator = {SELECT FIRSTNME, LASTNAME FROM
db2admin.EMPLOYEE WHERE WORKDEPT = :workdept};
    rs1[0] = sproc3_iterator.getResultSet();
   
       ctx.close();
     } catch (SQLException sqlexcp)
     {
sqlexcp.getMessage();
    error = 'y';
     }
   }
}

The stored procedure definition is:
CREATE PROCEDURE SP3 (IN in1 CHAR(6))
LANGUAGE JAVA
PARAMETER STYLE JAVA
DYNAMIC RESULT SETS 1
FENCED THREADSAFE
EXTERNAL NAME
'sproc3.sproc3mtd';

TIA
Raquel.
Raquel - 25 Jun 2004 12:42 GMT
Please don't bother...it is not returning anything because the table being
referred to in the stored procedure (db2admin.EMPLOYEE) does not exist. It
is actually db2adm.EMPLOYEE. This solved the problem.

Thanks.
Raquel.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.