I just installed iReport(Product Version: iReport Professional 3.7.1.1) and try to create exiting crystal report file using iReport to see it makes my life easier.
First bump that I faced was Oracle stored procedure. I found below post and tried to apply it.
1) Set the Query language in the Report Query to plsql
2) Use the following syntax for the call "{call MyPackage.MyStoredProc($P{Cursor},$P {InputParam})}"
3) Define the Cursor param as java.sql.ResultSet
4) Type in the Fields of the result set by hand. I could not get the Automatically Retrieve Fields to work.
I am using iReport 3.7.1 on Windows XP which is bundled with the jasperreports-extensions-3.5.3.jar that contains the necessary PlSqlQueryExecuter classes.
I have conformed PlSqlQueryExecuter class exits in my classpath, the error message I got is
The parameter 'Cursor' is not defined
Here is my question.
1. Does anyone know how to define Ref Curssor in the iReport?
2. How do I type in the fields of the result set by hand??
Thanks for you time
You will have to set your Cusor out parameter datatype as java.sql.ResultSet you can do this by clicking the Add New Parameter and just type the data type as said above and click ok...Also make sure you uncheck the "Prompt for Parameter" in the Cursor's property in the report designer...
You can follow the article in the below link... this article gives a step by step instruction on how to create stored Procedures and call the stored procedure in your JasperReport / iReport... hope this helps
http://meezageekyside.blogspot.com/#!/2012/04/jasper-reports-ireport-45-using-oracle.html
keep us posted on your findings as well....
Related
I have got this problem with FireDAC -> FDQuery component when it tries to select data from a database with '.' (dot) in its name.
The database name is TEST_2.0 and the error on Opening the dataset says:
Could not find server 'TEST_2' in sys.servers [...]
I have tried {TEST_2.0} (curly brackets) and [TEST_2.0] (square brackets). Also setting QuotedIdentifiers (Format Opetions) property to True does not seem to fix the problem. In SQL query I can add 'SET QUOTED_IDENTIFIER ON;' but this breaks inserts to the dataset.
The FDConnection component can connect to that server and that database using MSSQL driver without problems. It seems it is the dataset that dosn't handle it. UniDAC seems to handle everything without any problems.
I am using RadStudio 10.2.
Has anyone found any solution to this? Thanks in advance for any replies
I got a response from Emarcadero and it works for me:
"The problem is not in FireDAC, but in SQL Server ODBC driver
SQLPrimaryKeys function. It fails to work with a catalog name
containing a dot. FireDAC uses this function to get primary key fields
for a result set, when fiMeta is included into FetchOptions.Items. So,
as a workaround / solution, please exclude fiMeta from
FetchOptions.Items."
What is wrong?
I was able to reproduce what you've described here. I've ended up on metainformation command, specifically the SQLPrimaryKeys ODBC function call. I have used SQL Server Native Client 11.0 driver connected to Microsoft SQL Server Express 12.0.2000.8, local database server instance.
When I tried to execute the following SQL command (with TEST_2.0 database created) through a TFDQuery component instance with default settings (linked connection object was left with empty database connection parameter) in Delphi Tokyo application:
SELECT * FROM [TEST_2.0].INFORMATION_SCHEMA.TABLES
I got this exception raised when the SQLPrimaryKeys function was called with the CatalogName parameter set to TEST_2.0 (from within the metainformation statement method Execute):
[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL
Server]Could not find server 'TEST_2' in sys.servers. Verify that the
correct server name was specified. If necessary, execute the stored
procedure sp_addlinkedserver to add the server to sys.servers.'.
My next attempt was naturally modifying that CatalogName parameter value to [TEST_2.0] whilst debugging, but even that failed with similar reason (just failed for the name [TEST_2), so for me it seems that the SQLPrimaryKeys ODBC function implementation with the driver I've used cannot properly handle dotted CatalogName parameter values (it seems to ignore everything after dot).
What can I do?
The only solution seems to be just fixing ODBC drivers. Workaround I would suggest is not using dots in database names (as discussed e.g. in this thread). Another might be preventing FireDAC from getting dataset object metadata (by excluding fiMeta option from the Items option set). That will bring you the responsability of supplying dataset object metadata by yourself (at this time only primary key definition).
I'm writing an application that has to open a preexisting BDE database that has been saved by a third party.
In this application, I currently have a TDatabase (DriverName: STANDARD) with path set correctly in Params.
I can now set Connected to true without an error message.
There is also a TTable with DatabaseName set to the values of the TDatabase and TableName set to the .db-file that lies in the folder (the name was automatically filled in, I only hat to select it).
Now the problem:
If I set Active to true, an error message complains about missing access rights for C:\PDOXUSRS.NET.
I know I could set another path using BDEADMIN, but I need to solve this in my application - I can't expect every customer to do this change.
Furthermore, I have a test machine with the third party application running - it can access the database without any error, while my application throws the aforementioned error. This leads me to the suspicion there might be a workaround.
Is there such a workaround?
I only need read access to the database.
Solved it thanks to the link of bummi
Thank you very much.
Quote:
How to change NET DIR programmatically so it persists
[...]
You should also remember that if you have programs that change their own NET DIR locations at runtime, using either the DbiSetProp function or the NetFileDir property of a TSession component, this will override the NET DIR value in the configuration file.
It pointed me to the possibility of changing the NET DIR in code:
Session.NetFileDir := MyCustomTempDir;
After doing that, Table1.active := true works and the data shows up in a connected TDBGrid.
can anyone provide complete tutorial on how to call stored procedure that returns sys_refcursor from ireport 4.5.1.
i have already followed this link
http://rajendratambat.blogspot.in/2011/10/calling-oracle-stored-procedure-in.html?showComment=1333264003761#c6148133813463786818
but it doesn't work for me.so can anyone have another solution.
Below are the steps to call a stored procedure to build a report using iReport 4.5/4.5.1 JasperReport
In your iReport designer go to Tools --> Options --> and in the Classpath Tab click Add JAR and add the OJDBC14.jar to the classpath.
Go to Query Executer tab and set the following
Language: plsql
Query Executer Factory: com.jaspersoft.jrx.query.PlSqlQueryExecuterFactory
Fields Provider Class: com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider
Select Database JDBC Connection
Select Oracle as the JDBC Driver as shown in the image below and verify the connection by clicking the Test button (Make sure you check the Save Password check box)
Create a blank report by giving a report name and save it.
Open the report in the designer and right click on the report name and click on Edit Query
Set the query language to plsql
Call your procedure with in { }
a. {call PUBLISHER_AND_BOOKS(&P(P_PUBLISHER_ID), &P(ORACLE_REF_CURSOR))}
Note: P_PUBLISHER_ID is of type string and ORACLE_REF_CURSOR is of type java.sql.ResultSet data type custom parameter. You can create this by clicking the New Parameter button. If you have more input parameters use ‘,’ as your delimiter as shown in the above example.
Click Ok and proceed with the report design.
In the designer window right click on Fields and add click Add Fields and make sure all the field name matches the column name in your stored procedure
Now right click on the parameters and add the parameters matching the stored procedure NOTE: make sure you uncheck the "Use for Prompt" in the property for your out parameter in our example its ORACLE_REF_CURSOR is the out parameter.
Drag and drop the fields in the report detail band as shown below
Click preview to run the report you will be prompted with the input parameter
All the steps are captured in detail with images and available in the below link hope this helps...
http://meezageekyside.blogspot.com/#!/2012/04/jasper-reports-ireport-45-using-oracle.html
How could we know which WLM job has picked my DB2 stored procedure call invoked. I see some set of jobs are running with DB2XWLM* where DB2X is database region. But how to check which particular job had taken my stored procedure call.
Hope I made clear, please let me know if something is not clear. Appreciate your interest.
By giving few 'unique display statements' in the Stored procedure and by making the display statements on , we can check which WLMjob has picked the Stored procedure.
Typically a stored procedure is assigned to a region when it's created.
If you are able to see the DDL for the CREATE PROCEDURE statement (perhaps through DB2 admin tool), there should be a line like:
WLM ENVIRONMENT DB2SP3
DB2SP3 would be the environment your stored procedure lives in. I'm not sure that it always works this way, but it's worth checking.
Go to the job output where you can see display statements of your SP. That JCL has WLM specified. Just search for WLM word and you can find it.
I realize this is an old post but here is the answer for future reference:
select schema ,owner ,name ,WLM_ENVIRONMENT
from SYSIBM.SYSROUTINES
where schema = 'yourschemaname'
and name = 'yourSPname'
WLM_environment is the column you are looking for.
(db2v11)
I would like to test a DB2 stored procedure running on an AS400 system.
I have the IBM System i Access for Windows installed and can run SQL commands against the DB2 database.
My question is: What is the syntax to execute a stored procedure that takes in a parameter and returns a result as an output parameter and print the value to the screen?
Just to clarify: I am not asking how to call the proc in code. I want to execute the proc and see the results in the gui tool (which is similar to SQL Enterprise Manager).
use the keyword call and pass in the parameters.
call myStoredProc(parm1, parm2, ?);
for more details see here http://www.ibm.com/developerworks/data/library/techarticle/dm-0503melnyk/. The interesting part is Figure 5. Using the Command Editor to call an SQL procedure
What you want is possible. I have done it myself many times. Unfortunaly, I'm not at the office right now so it must be from the top of my head.
Start System i Access
Go to your iSeries icons and log on to the one where your stored procedure lives
Go to the databases icons and connect to the correct one (you've one local and probably one or more remotes)
Only then, you will see the option "run SQL script" at the bottom of your screen
Start that option and you will see a SQL editor (editor on top, viewer/messages at the bottom)
Remember that you are already connected to the correct iSeries but your JDBC request will get the *LIBL of the userprofile of your connection. Therefore you must know the schema (iseries library) of your stored procedure
Enter "call YOURSCHEMA.YOURSTOREDPROCEDURE(?,?);" and use the menu or shortcut to run that statement. Notice that - depending on your JDBC settings (see menu) - the correct syntax may be "/" instead of ".". Also, notice that you can replace the first question mark with a value.
On an additional note,
In iAccess, under every schema you will see icons for the tables, views and so on. Also an icon for stored procedures is available. You will see your SP there. Use the options to see the definition and so. This information includes detailed information about the parameters
If you want to check that on your iSeries, use the system catalog (this can be done from the SQL editor too) with "select * from qsys2.sysprocedures where procedure_name (sorry, not sure about the name of this column right now) = 'YOURSTOREDPROCEDURE';"
VERY IMPORTANT: I was never able to test the SP with the SQL editor (STRSQL) on the iSeries itself. Only the iAccess SQL editor did work correctly.
You should be able to run your SP like this:
DECLARE
usr_in YOUR_TABLE.YOUR_COLM%TYPE; --Gets the correct type by looking at column type
app_in YOUR_TABLE.YOUR_OTHER_COLM%TYPE;
BEGIN
usr_in:='some value';
app_in:='another_value';
YOUR_SP_NAME(usr_in, app_in);
END;
Or you can use EXECUTE, but it can't be dynamically prepared (not run in Java) and I think there's some other disadvantages.
EXECUTE myStoredProc(parm1, parm2, ?);