Riase error in Sybase with UNIDAC

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Riase error in Sybase with UNIDAC

Post by sasdua » Tue 23 Aug 2011 15:00

We are using Unidac Stored Proc Component in Delphi 10 with Sybase 12.5 drivers

In Sybase proc we are raising error like below,i found it is retruning back but it not showing error message.Is this not working in Unidac or any other issue?

we already using set ansinull off so comparision " null" is working for us..

if @number null
begin
select @errmsg = 'Already active for location '
raiserror 20001 @errmsg
return 1
end


In Delphi we are using UniStoredProc Component

Code: Select all

     with StoredProcUpdate do
      begin
      ExecProc;
      Open;
     end;
it giving error like No Rows retruned ..if we remove open..it is going into if clause mentioned above but it not returning the the error message riased


i tried to execute stored proc using "try expect" also

Code: Select all

try
ExecProc;
except
DisplayException;
end
It is very urgent..pls help..is it bug in Unidac or my code is wrong? :cry:

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 24 Aug 2011 10:53

If i try like below am able to catch exception with Sybase 15 Client Libraries but not with 12.5 client libraries

Code: Select all

 try
  ExecProc;
  except on E:Exception do
    begin
     ErrorMsg(EDatabaseError(ExceptObject).Message,0);
     Exit;
   end;

AndreyZ

Post by AndreyZ » Wed 24 Aug 2011 12:48

Hello,

I cannot reproduce the problem. I've created the stored procedure in the following way:

Code: Select all

create procedure test
as
begin
  declare @errmsg varchar(30)
  select @errmsg = 'Already active for location'
  raiserror 20001 @errmsg 
  return 1
end
, and used the following code:

Code: Select all

try
  UniStoredProc.StoredProcName := 'test';
  UniStoredProc.ExecProc;
except
  on E:EUniError do
    ShowMessage(E.Message);
end;
As a result, the 'Already active for location' exception was raised. Please try using the code above and check if the problem persists.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 24 Aug 2011 13:01

We are using Sybase 12.5 Client Libraries

Even with EUniError also am not able to Raise the exception.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 24 Aug 2011 13:37

I believe it is raising unknown exception which we couldn't able to capture

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 24 Aug 2011 15:00

pls help in this regard we already postponed our release so many times

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Thu 25 Aug 2011 13:49

Do you guys support Sybase 12.5 sybase client libraries or not?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 26 Aug 2011 12:44

Hello,

We have checked this situation again. The error occurs regardless of the client version used (12.5 and 15). Please send us a complete DDL script of the procedure and the piece of code where the procedure parameters are set and the procedure is called.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Fri 26 Aug 2011 14:01

Alex,we have tried same example which AndreyZ has posted above even that also we are not able to catch

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Fri 26 Aug 2011 14:03

Will it differs based on the server?

Our DB is on Sybase 15 server and we are connecting with Sybase 12.5 Client libraries will it matters?

or will it impact any how the fuctionality of the drivers?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 26 Aug 2011 15:29

Hello,

I have tested this behavior exactly on the client 12.5 and server 15, and everything have worked perfectly. As I understood of the preceding, the operators are executed after the raiserror call (return 1). If this is the situation, the problem is most probably on the server side, not on the client side.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Mon 29 Aug 2011 05:00

Hi Alex..Thanks for checking..

Can you please let me Is there any configuration options to set on server,we are using Sybase 15.0.3 server.Please let us know which server you have tried on.

Alex i found one more thing..when we use uni query component and try to "exec proc" it is returning like "No rows returned"

Code: Select all

Query.Add("exec test");
Open;

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 30 Aug 2011 12:43

Hello,

We tried to reproduce the problem on the same server version – 15.0.3.

This error message is correct because if you call UniQuery.Open, it is expected that DataSet will be returned after execution, but as the procedure does not return DataSet, you are getting this error message. You can use the UniQuery.Execute method or the TUniStoredProc component to solve the problem.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Fri 02 Sep 2011 13:37

AlexP wrote:Hello,

We tried to reproduce the problem on the same server version – 15.0.3.

This error message is correct because if you call UniQuery.Open, it is expected that DataSet will be returned after execution, but as the procedure does not return DataSet, you are getting this error message. You can use the UniQuery.Execute method or the TUniStoredProc component to solve the problem.
you mean to say..you are not able to reproduce yet?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 14 Sep 2011 10:43

Hello,

As I've told you earlier, this error ("No rows returned") occurs if procedure does not return DataSet, and you should call it with the help of the Exec method.

Post Reply