This will require Data Admin privileges to setup and Builder for implementation.
iDashboards is able to connect to an Oracle Database as Data Source by using a JDBC driver to access and connect to the Oracle Database as a data source. A JDBC driver is a software component enabling a Java application to interact with a database. To connect with individual databases, JDBC (Java Database Connectivity API) requires specific drivers for each database. The JDBC driver gives out the connection to the database and implements the protocol for transferring the query and result between the client and the database. iDashboards implements native protocols and does not require additional software installed on the driver host. In other words, iDashboards provides driver connectivity with the JDBC Data Source via the specified driver. This document explains a step-by-step procedure to create the Data Source with an Oracle driver.
Oracle Stored Functions
With this connection, one has the ability to not just pull data directly from the database tables and views by column mapping or writing custom SQL queries, it also gives the ability to derive data from that Data Source's Functions. This elaborates on Stored Functions (Stored Procedures) and shows detailed step by step instructions on how to derive data from a Function of an Oracle Data Source. iDashboards only supports Oracle Functions when it comes to Oracle data sources. It is required for a function to result in at least two values in the form of a REF CURSOR. One output will be used for an x-axis and one output for a y-axis. More outputs can be configured for multiple y-axes. The return or output data types are the following:
• Integer
• Number
• String
• Date/Datetime
Input arguments are supported but not necessarily required. The input argument can be either Input mode or Input/Output mode. If an input argument is necessary for the function to work properly, iDashboards can be forced to supply one. The return or output data types are the following:
• Integer
• Number
• String
Date and Datetime data types are not supported as procedure arguments. In order to use the Date data
types, the Date needs to be passed into the function as a string and converted to a Date/Datetime within
the function. If you are using Oracle as a Data Source, you will need to utilize the following Optional Driver Properties to use the Stored Functions (Stored Procedures) of your respective database within iDashboards Data Admin or iDashboards Admin:
oracle.jdbc.defaultNChar=true
Using an Oracle Function
To use an Oracle PL/SQL Function as an iDashboards Data Source run the following code against your Oracle Database. You can do this from the SQL Command Prompt or from a SQL editor.
DROP TABLE data_test;
CREATE TABLE data_test (x NUMBER(5) NOT NULL primary KEY, x_squared NUMBER(10) NOT NULL,
pivot NUMBER(5) NOT NULL);
DECLARE
x INTEGER := 1;
y INTEGER;
pivot INTEGER;
BEGIN
FOR x IN 1..1001 LOOP
y := x * x;
pivot := ((x+50) / 100);
INSERT INTO data_test VALUES(x, y, pivot);
END LOOP;
END;
/
COMMIT;
CREATE OR REPLACE PACKAGE pkg AS TYPE ref_cursor IS REF CURSOR;
FUNCTION y_equals_x_squared(lo_x IN NUMBER, hi_x IN NUMBER) RETURN ref_cursor;
FUNCTION y_equals_x_squared(lo_x IN NUMBER, hi_x IN NUMBER, dummy IN NUMBER) RETURN ref_cursor;
END;
/
show errors
CREATE OR REPLACE PACKAGE BODY pkg AS
FUNCTION y_equals_x_squared(lo_x IN NUMBER, hi_x IN NUMBER) RETURN ref_cursor IS c ref_cursor;
BEGIN
OPEN c FOR
SELECT * FROM data_test
WHERE (lo_x IS NULL OR x >= lo_x)
AND (hi_x IS NULL OR x <= hi_x);
RETURN c;
END;
FUNCTION y_equals_x_squared(lo_x IN NUMBER, hi_x IN NUMBER, dummy IN NUMBER) RETURN
ref_cursor IS c ref_cursor;
BEGIN
OPEN c FOR
SELECT * FROM data_test
WHERE (lo_x IS NULL OR x >= lo_x)
AND (hi_x IS NULL OR x <= hi_x);
RETURN c;
END;
END PACKAGE pkg;
Execute in SQL Command Prompt: @y_equals_x_squared(x,y);
Stored Functions as a Data Source
Go to either Data Hub or iDashboards Admin and log in with your iDashboards credentials.
- Click Data Sources
- Then click on New
- You will then fill out the highlighted fields, what has worked for us is shown below:
Data Source Name: CDATA-REST (Internet URL)
Server Name: YourServerName (if on server can use localhost)
Database Name: YourDatabaseName
Optional Driver Properties: oracle.jdbc.defaultNChar=true
Schema: Put in a Schema Pattern for best Performance
Select: Quotation Marks, Quote Table and Column Names, Allow Custom Queries
Driver Download: For JDK 8 and 9 user odbc7.jar - Then Click Save
- Now Edit this Data Source
- Go the the bottom and click Stored Procedures
- A new box will pop up, click the (+) outlined below
- Fill in the following, you will need to click (+) for Procedure Arguments and Output Columns
- Once you have clicked the (+) for those fields it will look as below and you can fill them out:
- You MUST put in the Arguments and Columns in EXACTLY as they are in Oracle.
- Procedure Name: pkg.y_equals_x_squared
- Procedure Schema: Owner
- Procedure Arguments
- Output Columns
- When you are finished click Save then you will see the following popup message and click OK
- You will then see the stored procedures listed and will be able to (x) or close out of the box
- You can then Save the Edit a Data Source box
- Now you can create a New Data Set (if using iDashboards, create a new chart in Builder)
- Select Table/View
- Now Create Your Charts!
For More Information:
- Creating a Database URL (Connection String)
- Oracle Stored Procedures and Functions Documentation
- iDashboards Admin Manual 10. Managing Data Sources
- iDashboards Admin Manual 12. Using Stored Procedures
Disclaimer: iDashboards Technical Support Engineers are not proficient in the Management and Integration of every API that exists as new APIs are being created everyday with each company that wants to provide seamless integration with other software. However, we do our best to help you make these connections because we want to assist you in your success. If you do not see an article for a connection you would like to make please contact iDashboards Support and know that it will take a bit of time to figure out what is necessary for this integration.
If the above is unable to resolve the issue, then please contact iDashboards Support for further assistance.
Comments
0 comments
Please sign in to leave a comment.