Link to home
Start Free TrialLog in
Avatar of IncognitoMan
IncognitoManFlag for Bulgaria

asked on

How To Execute Script On Firebird

Hello guys, I wrote some scripts, using IBExpert, but my problem is, I don't know with which statement I can call them outside IBExpert. For example in a C# program. I looked over the google, but when i write "execute script", it shows me how to write the script. So for example the script has three input parameters and four output. I tried like executing astored procedure:
execute procedure procName(input1, input2);
But it gives me an error.
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

I'm rather confused what you are asking for:

- call a stored proc from c#
- run a script of sql or ddl instructions in general or with ibexpert
- how to pass parameters into a script
Avatar of IncognitoMan

ASKER

- run a script of sql or ddl instructions in general or with ibexpert
- how to pass parameters into a script

For example, I have a script, that takes some value from another DB and the first input parameter is the path to the database and the other is what value should be extract. After that the value should be put in the database the script is contained in and if all those operations are OK it returns true. But my problem is how to call the script in a C# application.
Check out this link and see does it help you.

http://firebirdsql.org/pdfmanual/Firebird-fb-shell-scripts.pdf
Avatar of markusventer
markusventer

You should be able to use a sql query (I am not sure what the databinding component is called in c#) and specify the SQL script to execute, i.e. exec YOUR_PROCEDURE(Param1, Param2).  Instead of opening the query you should be able to call execsql or a similar method on the query.
I need the whole syntacsis, because I've already tried
execute block blockname(param1, param2)
but it doesn't work.
You should not need to call excute block.

1.) Make sure the logged on user has execution rights to the proc.
2.) In your application you should just call execute procedure PROCEDURENAME.

Do not use the syntax execute block.  

What is the specific error you are getting?
If I use the execute procedure procname(....) it says "Unknown procedure procname". So this doesn't work.
Well the error is unknown token, but I don't know the sintacsis of calling a ibe script or block, so everything i've written is a guess. So is there someone that really knows how to call a block. To make it execute?
So let me explain it better. I create an Firebird script using IBExpert. Then I save it in the database. But how to call it. Which statement to use? How to run the script, how to pass parameters to it?
Are you sure the procedure is visible to the user you are logged in as?  

grant select on [procedure] to [user].

You could also try:    select * from [Procedure Name]

Can you at design time specify the in/output parameters of the query perhaps?  This is a wild guess as I am not familiar with C#.
The user is SYSDBA, so everything is visible for him. And it is not a procedure, but a script, an ibeblock if you know what it is. And I just need the query to run the block. In C# i just can send queries to the database as I use ODBC to connect to firebird.
OK, sorry then.  To execute the script you would have to use ibescript dll.  A seperate license required if you want to distribute it.  IBEBlock is ibexpert proprietary scripting technology.
Is there any documentation on how to use this dll or can you explain it to me?
ASKER CERTIFIED SOLUTION
Avatar of markusventer
markusventer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank  you, I'll look in it. I wrote everything in the Visual Studio itself and didn't need the block, but also wrote a block, so maybe I'll choose the block cos it's faster.
You are welcome.  Just bare in mind the licencing costs for using IBEScript.dll