freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Jonathan Boutelle" <jonathan.boutelle AT commerceone.com>
- To: freetds
- Subject: Error when excecuting sqlserver7 stored proc
- Date: Mon, 21 Feb 2000 18:16:24
When I call this stored proc (included below), I get the following
SQLException.
I can run it fine from within sqlserver7 (both thru the query analyszer and
using visual interdev).
Protocol Confusion found a com.internetcds.jdbc.tds.PacketMsgResult (packet
type 0xab)
The java code that calls the stored procedure is also included. I've run
stored procs before on my system using the TDS driver, so it must be
something specific to this stored proc.
Thanks in advance to anyone who has any suggestions!
-jonb
JAVA CODE
public void addNewProjectToQueue(Supplier s, ProjectPrototype pp){
int projectPrototypeID = pp.getId();
int supplierID = s.getID();
int adminID = getAdminID();
try{
Connection con
=DbaseHub.getDbaseHub().getConnectionContainer().getConnection();
String callString= "{newProject(?,?,?,?,?) }";
CallableStatement cs = con.prepareCall(callString);
cs.setInt(1, supplierID);// parameter 1
cs.setInt(2, projectPrototypeID);//parameter 2
cs.setInt(3, SharedConstants.projectStatusInQueue);//parameter 3
String projectName=s.getName()+pp.getName();
cs.setString(4,projectName);//parameter 4
int id = getAdminID();
cs.setInt(5,id);
cs.execute();
}
catch(SQLException sex){
Debug.log.debug("Excep caught in
ProjectDbaseHub.changeServiceStatus("+
pp.toString()+s.toString()+
ExceptionUtil.getExceptionDetails(sex));
}
}
STORED PROC
CREATE PROCEDURE newProject
@supplierID int,
@projectPrototypeID int,
@projectStatusID int,
@projectName char(100),
@projectOwner int
as
/*first add to to Project table*/
INSERT INTO Projects(ProjectPrototypeID, SupplierID,
StatusID,ProjectName, OwnerID) values(@projectPrototypeID,
@supplierID,@projectStatusID,@projectName,@projectOwner)
/*what was the ProjectID of that project (identity column)*/
declare @projectID int
Declare tableCursor1 CURSOR FOR
Select ProjectID from Projects where
(ProjectPrototypeID=@projectPrototypeID and SupplierID=@supplierID) order
by ProjectID
Open tableCursor1
fetch next from tableCursor1 into @projectID
print @projectID
Close tableCursor1
deallocate tableCursor1
if(@projectID=null) return
/*now get all the milestoneprototypes for the stated project prototype*/
declare @stage float
declare @name char(100)
declare @numDays int
declare @counter int
DECLARE tableCursor2 CURSOR FOR
select Stage, MilestoneDescription, NumDays from MilestonePrototypes
where ProjectPrototypeID=@projectPrototypeID order by Stage
Open tableCursor2
FETCH NEXT FROM tableCursor2 into @stage, @name, @numDays
WHILE @@FETCH_STATUS = 0
BEGIN
IF @counter>0
BEGIN
Insert INTO Milestones(ProjectPrototypeID, ProjectID, Stage,
DefaultMileStone, Completed) values(@projectPrototypeID,
@projectID,@stage,1,0)
END
set @counter =1
FETCH NEXT FROM tableCursor2 into @stage, @name, @numDays
END
Close tableCursor2
DEALLOCATE tablecursor2
return 1
-
Re: Error when excecuting sqlserver7 stored proc,
Jonathan Boutelle, 02/21/2000
- <Possible follow-up(s)>
- Error when excecuting sqlserver7 stored proc, Jonathan Boutelle, 02/21/2000
- Re: Error when excecuting sqlserver7 stored proc, Jonathan Boutelle, 01/29/2024
Archive powered by MHonArc 2.6.24.