Ldap function gives errors in apex 4.1.1
Hi all,
I have a custom function for ldap authentication.
create or replace
FUNCTION bgt_ldap_authenticatie_func (
p_username IN VARCHAR2
, p_password IN VARCHAR2
RETURN BOOLEAN
AS
l_ldap_host VARCHAR2(100) := 'domain';
l_ldap_port VARCHAR2(4) := '389';
l_session DBMS_LDAP.SESSION;
l_retval PLS_INTEGER;
l_login_result BOOLEAN := true;
l_error VARCHAR2(4000);
BEGIN
IF p_password IS NULL THEN
l_login_result := FALSE;
ELSE
-- I. LDAP-Login
BEGIN
-- LDAP Exceptions
DBMS_LDAP.USE_EXCEPTION := TRUE;
-- LDAP-Handle initialiseren ...
l_session := DBMS_LDAP.INIT(
hostname => l_ldap_host
, portnum => l_ldap_port
l_retval := DBMS_LDAP.SIMPLE_BIND_S(
ld => l_session
, dn => 'domain\' || LOWER(p_username)
, passwd => p_password
-- Afmelden van LDAP Server.
l_retval := DBMS_LDAP.UNBIND_S(ld => l_session);
-- Registratie was succesvol.
l_login_result := TRUE;
EXCEPTION WHEN OTHERS THEN
l_login_result := FALSE;
END;
END IF;
RETURN l_login_result;
END;This is working fine on Apex 3.2 and Oracle 10g.
I now have a development environment with apex 4.1.1 and Oracle 11g.
I have run above function, with success (no compilation errors).
I then go to authentication schemes to create my ldap authentication:
host: domain
port: 389
Distinguished Name (DN) String: ou=domain,ou=New Security Groups,ou=Applications,cn=Budgeting_Dev
Use Exact Distinguished Name (DN): Yes
LDAP Username Edit Function: return bgt_ldap_authenticatie_func;
When I click on the create button, I get
1 error has occurred
ORA-06550: line 5, column 8: PLS-00382: expression is of wrong type ORA-06550: line 5, column 1: PL/SQL: Statement ignoredWhy is it that I'm getting an error when trying to create the authentication when the function has been successfully compiled?
Thanks,
Diana
Hi Diana,
in addition to Christian comment, the "LDAP Username Edit Function" attribute expects a function which returns VARCHAR2 and not BOOLEAN as your function returns. It should also not be used to actually perform a LDAP lookup, instead it returns the LDAP Username you want to give APEX to perform the LDAP lookup.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf
Similar Messages
-
AVG as an analytic function - gives error ORA-0439
I'm trying my first implementation of AVG as an analytic function. I took the following query which gave a simple average:
SELECT
PERSON.LASTNAME,
COUNT(TO_NUMBER(RPTOBS.OBSVALUE)) CNT,
AVG(TO_NUMBER(RPTOBS.OBSVALUE)) AVRG
FROM
TUT.PERSON PERSON,
TUT.RPTOBS RPTOBS
WHERE
PERSON.PID = RPTOBS.PID AND
RPTOBS.HDID = 54
GROUP BY
PERSON.LASTNAME;
and was rewrote this to give an average of the values of the last 3 dates (I think..)
SELECT
PERSON.LASTNAME,
RPTOBS.OBSDATE,
AVG(TO_NUMBER(RPTOBS.OBSVALUE))
OVER
(PARTITION BY PERSON.LASTNAME
ORDER BY RPTOBS.OBSDATE
ROWS BETWEEN UNBOUNDED PRECEDING AND 2 FOLLOWING)
AS AVRG3
FROM
TUT.PERSON PERSON,
TUT.RPTOBS RPTOBS
WHERE
PERSON.PID = RPTOBS.PID AND
RPTOBS.HDID = 54;
(this seemed to be a direct translation of a similar query in the SQL Reference.
I am getting an error message of:
ORA-0439 - feature not enabled - OLAP Window Functions
Can some one tell me why?
Thanks,
Will Salomon
[email protected]I haven'y done it personally, but I am told that it's really as simple as de-insatlling the Standard Edition software and then installing the Enterprise Edition. Th einstaller will prompt you for an Oracle SID and you just have to point it to your existing database.
You may wish to test this proposition before risking your actual system. But, in any case, take a back up.
With 9i things are simpler: everyting gets installed, you're just not allowed to use the EE features if you haven't paid for them.
Cheers, APC -
Using DBMS_LOCK in function gives error
Dear Guru's
I need to use the DBMS_LOCK.sleep. Hence to get more info i searched the forum and I found this code from the forum
CREATE OR REPLACE
FUNCTION sleep (secs_in IN INTEGER) RETURN NUMBER
is
BEGIN
DBMS_LOCK.sleep(secs_in);
RETURN secs_in;
END;
and tried it in my envrionment..
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.1.0.4.2
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION SLEEP:
LINE/COL ERROR
4/5 PL/SQL: Statement ignored
4/5 PLS-00201: identifier 'DBMS_LOCK' must be declared
I tried using the DBMS_LOCK in a Nameless procedure like this
begin
dbms_lock.sleep(5);
end;
there was no error message and i got a message that it has been executed successfully
I tried it similarly in a stored procedure , then also i got the same error message
Please enlighten me on this issue.
with warm regards
ssrSounds like you've got execute privs on dbms_lock granted to your user as part of a role. You need to have a direct grant on dbms_lock in order for what you're trying to do to work. (ie. you need to get someone with the appropriate privs to run the following: grant excute on dbms_lock to your_user;)
-
Database Trigger gives error in APEX form
Hi
I have a table that has an on insert and on update trigger on the database table that is in the apex form. when applying changes or creating a new row fields are populated in the table for who and date. This works as expected but not in APEX.
in apex when trying to create or apply changes the following error is given
ORA-20505: Error in DML: p_rowid=hello, p_alt_rowid=ID, p_rowid2=, p_alt_rowid2=. ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "AIT_MSTR.UPDATE_ACCOUNT_ROW", line 9 ORA-04088: error during execution of trigger 'AIT_MSTR.UPDATE_ACCOUNT_ROW'
Error Unable to process row of table ACCOUNT.
I am not sure, but I think this error is around the DATE field in the row. How can APEX be modified to not error out on the execution of the trigger?
the trigger is very simple
CREATE OR REPLACE TRIGGER AIT_MSTR.UPDATE_ACCOUNT_ROW
BEFORE UPDATE
OF ID
,DESCRIPTION
,CONNECT_ONLY
ON AIT_MSTR.ACCOUNT
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
NAME: UPDATE_ACCOUNT_ROW
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 6/9/2011 1. Created this trigger.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: UPDATE_ACCOUNT_ROW
Sysdate: 6/9/2011
Date and Time: 6/9/2011, 11:39:59 AM, and 6/9/2011 11:39:59 AM
Username: (set in TOAD Options, Proc Templates)
Table Name: ACCOUNT (set in the "New PL/SQL Object" dialog)
Trigger Options: (set in the "New PL/SQL Object" dialog)
BEGIN
:NEW.Update_Date := SYSDATE;
:NEW.Updated_By := USER;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END UPDATE_ACCOUNT_ROW;
Any help is greatly appreciatedHi
Yes you are correct it was the length of the Created_by and Updated_by column. i had to increase the size of those columns in the table
Now it works.
HOWEVER, it is not capturing the user name of the person logging into APEX that is creating or updating the record. The entry I see in the created_by or updated_by is ANONYMOUS. Which is not want is needed to be captured and recorded. Where is this anonymous value coming from and how can i get it to be the id of the APEX user instead?
Any help is greatly appreciated on this new issue -
Query run in Sql prompt correctly but give error in APEX report ORA-01843
Hi. all APEX user
Last week I upgrade APEX 3.2 to 4.0.2 . Now i have a problem. PL/SQL reports which are working in APEX 3.2 not working in 4.0.2. Help me.....
I am working on a mission critical application we have to upgrade there next month.
Query code is :-
select * from (
Select pp.PAYMENT_DATE,pp.PATIENT_ID,p.name as name,pa.Service_Subtype,pp.PAYMENT_RECEIPT_ID,pa.Ward_Type,(pp.TOTAL_CHARGE-pp.discount) as amount ,pa.Service_Booked_By,pp.PAYMENT_COLLECTOR,
case when pp.discount=0 then 1
when pp.TOTAL_CHARGE = pp.discount then 3
else 2
end payment_status
from patients p,PATIENT_Payment pp,PATIENT_account pa where p.patient_id = pp.patient_id and pp.patient_id=pa.patient_id and pa.SERVICE_SUBTYPE=pp.SERVICE_SUBTYPE AND pp.SERVICE_REGISTRATION_ID=pa.SERVICE_REGISTRATION_ID and
(pp.PAYMENT_DATE>=to_date(:P15_date_from,'dd-mon-rr')) AND
(pp.PAYMENT_DATE<=to_date(:P15_date_to,'dd-mon-rr'))AND
(pa.GROUP_NAME=:p15_Group or :p15_Group='ALL') AND
(pp.service_type=:p15_Service_Type or :p15_Service_Type='ALL') AND
(pp.SERVICE_SUBTYPE=:p15_SERVICE_SUBTYPE or :p15_SERVICE_SUBTYPE='ALL') AND
(pa.WARD_TYPE=:p15_Ward or :p15_Ward='ALL') AND
(pp.PAYMENT_COLLECTOR=:p15_Collector or :p15_Collector='ALL')
)order by pp.PAYMENT_DATE
) where payment_status=:p15_status
order by 1In your query, you expect the date to have the format 'dd-mon-rr'. Have you checked if the format of the date-items is of this format?
-
In Ref cursor, user defined functions give "invalid column" error in EJB.
Hello,
I have written PL/SQL stored procedures/functions in Oracle 8i. They return the result set as a ref cursor.
These procedures are accessed by EJB (weblogic) using Type 4 (100% Java) JDBC Driver.
My problem is - if I use a user defined function to fetch a value in the select statement of the reference cursor, the EJB gives an error msg - invalid column name.
If instead of using the function I get the value directly from the table, it works fine. Refer the code below :
//In the PL/SQL function -
//instead of writing :
Open rc for
Select empcode, empname
from emp ;
//If I write :
Open rc for
Select empcode, mypack.getempname(empcode)
from emp ;
//getempname(empcode) is a function in
//in a package named 'mypack'
//and returns name for empcode.
//The java code gives error
//error : invalid column name
//While both are working fine and
//returning currect result in SQL Navigator.
Help me solve this mystery ?
Thanks in advance.
Swati.
nullHi:
When use inline Function to simplify the SQL statements, there is one thing that one should conside--Purity Level.
if you create standalone stored pl/sql function. Oracle implicitly determines the PURITY level during compilation of the stored objects or at execution of an anonymous pl/sql block.
if you implement Package inline Function( in your case),unlike standalone stored pl/sql functions, the PL?SQL Engine does not determine the purity level of package functions. Therefore, you must explicity assign the correct purity levels for the function to be called inline.
the code like:
create or replace package mypack is
function getempname(empcode emp%empid%type)
return varchar2;
PRAGMA RESTRICT_REFERENCES(getempname,WNDS,WNPS,RNPS);
end mypack;
I think it can solve your problem if you use enough "pure"to be called inline function. Or you can create the standalone function to do it.
good luck!
Yali
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Swati Agrawal ([email protected]):
Hello,
I have written PL/SQL stored procedures/functions in Oracle 8i. They return the result set as a ref cursor.
These procedures are accessed by EJB (weblogic) using Type 4 (100% Java) JDBC Driver.
My problem is - if I use a user defined function to fetch a value in the select statement of the reference cursor, the EJB gives an error msg - invalid column name.
If instead of using the function I get the value directly from the table, it works fine. Refer the code below :
//In the PL/SQL function -
//instead of writing :
Open rc for
Select empcode, empname
from emp ;
//If I write :
Open rc for
Select empcode, mypack.getempname(empcode)
from emp ;
//getempname(empcode) is a function in
//in a package named 'mypack'
//and returns name for empcode.
//The java code gives error
//error : invalid column name
//While both are working fine and
//returning currect result in SQL Navigator.
Help me solve this mystery ?
Thanks in advance.
Swati.
<HR></BLOCKQUOTE>
null -
Copying a function group gives error
Dear All,
I am copying a function a group JV05. I have copied evrything i.e all the includes, TOP etc. But when i activate the group it gives me error. What could be the problem? I have tried to activate the includes & TOP individually. Still it gives error for some variables. Please help me out.
Thanks in advance!
Regards,
Prasadhi ,
**Go to se80..**
**1. Select function group**
**2. Enter JV05 as name "-----> click on spectacles button.**
**3. Right click on JV05**
**4. Select copy "--------> give a Zfunction group name**
**5. "Copy all the function modules in this function group with zfunctionmodules.**
**6. Save & Activate.**
Regards, -
Zoom In Function gives an error for Provider Not supported
Hello all,
I have an excel template which I connect to Essbase 11.1.2.3.(APS 11.1.2.3) using SmartView 11.1.2.1.102.
When I try a zoom in over a member manually in this template it works and it retrieves me the children of the member.
when I try to do the same using a VBA Code (HypZoomIN()) I get an error for zoom in function.
the error code is -41
This return value indicates that Provider is not supported..
what can be the reason for this failure, also when I execute the code and stop the execution just before the HypZoomIn() in code and if I try a manual Zoom In with the same template even then the function fails to execute.
so what can be the reason for this failure?I think the first time you have to click on "Adhoc Analysis" as that way it will convert the old / higher version to your current version of Smart View and once it retrieves successfully, then you can try the Zoom In and see
I am just guessing as it always asks me when the template was used in a different version and I try to use in a different version smart view
HTH
Amarnath
http://amarnath-essbase-blog.blogspot.com/ -
Function sequence error. in 64bit Windows 2008 Server.
Hi All,
Pardon me if the posting is not in the correct group.
I am migrating my application from 32bit(Windows 2003 Server) to 64bit (Windows 2008 Server R2).
I am getting the following while trying to execute a SQL command
Encountered ODBC error -1: S1010, 0, [Microsoft][ODBC Driver Manager] Function sequence error .
Basically internal function call is SQLExecute() function call. This works perfectly for Windows 2003 Server 32bit. I tried the command execute at the background from the command prompt and it is working.
I checked the squence of call.We have two consecutive SQLBindParameter function call and then we call SQLExecute. Is this sequence incorrect in case of 64bit? I also checked the return code given by SQLExecute which is 99.
Any help or suggestion would be very much appreciated.
Thanks,
-RHi Teun,
Yes i have build the addon & installer with x86. I am using Interop.SAPbouiCOM.dll , Interop.SAPbouiCOM.dll, System.dll , System.XML.dll.
I have not specified the relative path in code as such but iam loading my forms Load batch action i don't know if it ok in this scenario or not.
Building the Solution/Project is Successful without any warning.
While debugging it on my server it gives the same error "Object Reference Not Set to an Instance of an Object".
Debug Out put last errors are as follows:
A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll
'TAMPA800.exe': Loaded 'C:\Windows\SysWOW64\sxs.dll'
First-chance exception at 0x76afe124 in TAMPA800.exe: Microsoft C++ exception: EEMessageException at memory location 0x0036ecec..
A first chance exception of type 'System.IO.FileNotFoundException' occurred in TAMPA800.exe
A first chance exception of type 'System.NullReferenceException' occurred in TAMPA800.exe
The thread 'Win32 Thread' (0x460) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xdb8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xfdc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xfb4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xdc8) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xe04) has exited with code 0 (0x0).
The program '[3872] TAMPA800.exe: Managed' has exited with code 0 (0x0).
The program '[3872] TAMPA800.exe: Native' has exited with code 0 (0x0).
Regards
John -
Running SQL Procedure with dg4msql errors: Function sequence error HY010
I am trying to execute a stored procedure on a SQL database and get the error Function sequence error HY010.
A simple query on a table returns teh expected result.
I have a single Win2008R2 server with MSSQL Express 2008 and Oracle 11gR2 (32bit not 64bit version of Oracle)
Below is the gateway init, listener and tnsnames files and the query I am trying to run:
-- initORIONWASP.ora --
HS_FDS_CONNECT_INFO=INGRDB//waspForGIS
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
HS_CALL_NAME=dbo.spTest;dbo.spQueryAsset;dbo.spQueryAssetDetails
HS_FDS_PROC_IS_FUNC=TRUE
HS_FDS_RESULTSET_SUPPORT=TRUE
-- Listener.ora -- (partial)
(SID_DESC =
(SID_NAME = ORIONWASP)
(ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
(PROGRAM=dg4msql)
-- tnsnames.ora -- (partial)
ORIONWASP =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=INGRDB)(PORT=1521))
(CONNECT_DATA=(SID=ORIONWASP))
(HS=OK)
-- Simple Query --
Running select "Asset_ID" from asset@ORIONWASP; returns the correct result
Running select * from sys.procedures@ORIONWASP; returns a list of procedures including the procedure I want to run
-- This pl/sql block returns the error ******* identifier 'spTest@ORIONWASP' must be declared *******
declare
begin
"spTest"@ORIONWASP;
end;
-- This passthrough pl/sql block returns ******** [Oracle][ODBC SQL Server Driver]Function sequence error {HY010} ********
DECLARE
CRS BINARY_INTEGER;
RET BINARY_INTEGER;
v_COL1 VARCHAR2(50);
v_COL2 VARCHAR2(50);
BEGIN
CRS := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@ORIONWASP;
DBMS_HS_PASSTHROUGH.PARSE@ORIONWASP(CRS, 'exec spTest');
BEGIN
RET := 0;
WHILE (TRUE)
LOOP
ret := DBMS_HS_PASSTHROUGH.FETCH_ROW@ORIONWASP(CRS, FALSE);
DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 1, v_COL1);
DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 2, v_COL2);
DBMS_OUTPUT.PUT_Line('Col1:'||v_COL1||' Col2:'||v_COL2);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
DBMS_OUTPUT.PUT_LINE('End of Fetch');
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@ORIONWASP(CRS);
END;
END;
END;
/The gateway configuration file contains:
HS_FDS_PROC_IS_FUNC=TRUE
HS_FDS_RESULTSET_SUPPORT=TRUE
This setting commonly causes problems and you need to set
HS_FDS_PROC_IS_FUNC=TRUE
HS_FDS_RESULTSET_SUPPORT=FALSE
for normal procedure calls and
HS_FDS_PROC_IS_FUNC=FALSE
HS_FDS_RESULTSET_SUPPORT=TRUE
when calling the procedure with ref cursors.
There's a note in My Oracle Support that gives you examples how to call remote SQl Server procedures
Note.197192.1 Different Methods How To Call MS SQL Server Procedures Using TG4MSQL - DG4MSQL
and another one for the Sybase gateway but this code is similar for the SQL Server:
Article-ID: Note 351400.1
Title: How to Call a Remote Sybase Procedure Using TG4SYBS -
When I run RSPCM gives error in PC and message error, alert, popup
When I run the transaction RSPCM gives error in process chains and appear several popups, messages, alerts. what can be?
Symptom
The job log of a job contains message 00 517 (Job finished) and message BT
608 (Job status was manually set to 'cancelled').
Reason and Prerequisites
There is a program error in the function BP_JOB_ABORT.
Previously, the function BP_JOB_ABORT did not call the job status check
correctly. As a result, BP_JOB_ABORT may still have set a job that had
already finished correctly to 'cancelled'
Solution
Import the Support Package or implement the correction instructions -
Problem adding item to list using a function. Error - Null pointer
Hi Guys,
I'm not sure what the problem is, but for some reason I am unable to add an item to a list using a function. I can add an item when I call it in the same function that the list is created, but I cannot add the item from anoter function. Here is the code:
Main:
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class main {
* @param args
public static void main(String[] args) {
JFrame JFrame = new JFrame();
JFrame.setSize(400,400);
testpanel panel1 = new testpanel();
panel1.setBackground(Color.red);
JPanel panel2 = new testpanel();
panel2.setBackground(Color.BLUE);
JFrame.add(panel1);
JFrame.add(panel2);
JFrame.setLayout(new FlowLayout());
//THIS GIVES ERROR:
//NullPointerException
panel1.addListItem("test");
JFrame.setVisible(true);
}And here is the testpanel class:
* To change this template, choose Tools | Templates
* and open the template in the editor.
* testpanel.java
* Created on Apr 7, 2010, 6:10:24 PM
import java.awt.List;
import java.awt.ScrollPane;
import java.awt.event.ActionListener;
* @author Snowraver1
public class testpanel extends javax.swing.JPanel {
public void addListItem(String string){
list.add(string);
/** Creates new form testpanel */
public testpanel() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
ScrollPane scrollPane = new ScrollPane();
List list = new List();
jButton1.setText("jButton1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(49, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(46, 46, 46))
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(123, 123, 123)
.addComponent(jButton1)
.addContainerGap(139, Short.MAX_VALUE))
this.add(scrollPane);
scrollPane.add(list);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private ScrollPane scrollPane;
private List list;
// End of variables declaration//GEN-END:variables
}Thanks for the help!
-- SnowYou should check how you are initializing your variables in your testpanel class. You initialize your button correctly, but your other class variables are being overridden. As a result, your class variables still have a value of 'null'.
-
PL/PDF - Procedure test1 is executed but gives error
Hello All,
I have Oracle XE 10g with Oracle Apex and recently I installed PL/PDF in the same. I tried to execute the headerfooter procedure given in the installation guide. But it gives error ORA-20000: ERR-006 Procedure call error: xxfooter. How can I get the header and footer from this procedure headerfooter?
- create header footer procedure
CREATE OR REPLACE procedure headerfooter is
/* 7. Example: Header, Footer, number of pages */
l_blob blob;
begin
/* Initialize, without parameters means:
- page orientation: portrait
- unit: mm
- default page format: A4 */
plpdf.init;
/* Defines the page number alias.
Default: {nb} */
plpdf.nopAlias;
/*Sets the page header procedure name. The program name passed
as a parameter executes when the page header is created. */
plpdf.SetHeaderProcName(
p_proc_name => 'xheader', -- Page header procedure name: xheader
p_height => 10 -- Height of header section
/* Sets the page footer procedure name. The program name passed
as a parameter executes when the page footer is created. */
plpdf.SetFooterProcName(
p_proc_name => 'xfooter', --Page footer procedure name: xfooter
p_height => 10 --Height of footer section
/* Begin a new page, without parameters means:
- page orientation: default (portrait) */
plpdf.NewPage;
/* Sets the font and its properties */
plpdf.SetPrintFont(
p_family => 'Arial', -- Font family: Arial
p_style => null, -- Font style: regular (default)
p_size => 12 -- Font size: 12 pt
/* Draws a rectangle cell with text inside. */
plpdf.PrintCell(
p_w => 50, -- Rectangle width
p_h => 10, -- Rectangle heigth
p_txt => 'Page 1' -- Text in rectangle
/* Begin a new page, without parameters means:
- page orientation: default (portrait) */
plpdf.NewPage;
/* Draws a rectangle cell with text inside. */
plpdf.PrintCell(
p_w => 50, -- Rectangle width
p_h => 10, -- Rectangle heigth
p_txt => 'Page 2' -- Text in rectangle
/* Returns the generated PDF document.
The document is closed and then returned in the OUT parameter. */
plpdf.SendDoc(
p_blob => l_blob -- The generated document
/* Print it:*/
owa_util.mime_header('application/pdf',false);
htp.p('Content-Length: ' || dbms_lob.getlength(l_blob));
owa_util.http_header_close;
wpg_docload.download_file(l_blob);
end;
-Create footer procedure
CREATE OR REPLACE procedure xfooter is
begin
/* Sets the font and its properties */
plpdf.SetPrintFont(
p_family => 'Arial', -- Font family: Arial
p_style => 'I', -- Font style: Italic
p_size => 8 -- Font size: 8 pt
/* Print number of page */
/* Draws a rectangle cell with text inside. */
plpdf.PrintCell(
p_w => 0, -- Rectangle width
p_h => 10, -- Rectangle heigth
p_txt => to_char(plpdf.CurrentPageNumber) || '/{nb}', -- Text in rectangle
p_border => '0', -- Without frame
p_ln => '0', -- Cursor position after the cell is printed: Beside
p_align => 'C' -- Text alignment: Center
end;
Thanks.Thanks for your reply,
Since the owner of header/footer procedures is different than plpdf, I should have given the grants to plpdf schema but unfortunately I missed. Thanks for the answer it worked. Instead of creating synonyms for the procedures in plpdf schema I am passing procedure name with qualifier, the name of its owner, to plpdf api (owner.procedure_name). -
Function Sequence Error -- After upgrading to Crystal Reports 2008
Since we intergrated Crystal 2008 in our application, We are having the ODBC DRIVER ERROR "S1010, Function Sequence Error"
The following steps reproduces the error.
I open any crystal report(using my application) and close it.
And then I try to close another dialog in my application.
The destructor of that dialog has the DELETE FROM TMPRPT WHERE etc... But actually the TMPRPT table is empty.
But This Scenario in general, does not produce any error. Only after I open and close Crystal report, and when the TMPRPT table doesn't have any records, executing the above DELETE sql throws CDBException, Funciton Sequence Error.
Is it because of the upgrade/mismatch of dlls? Can any one help how to work around this?
Thanks.Hi Don,
I would like to thank you for your helpful advice. your tips for odbc tracing really works.
Just to simplify things, I have created a simple mfc dialog based application that opens a connection using CDatabase in the initdialog and closes the connection in the destructor(because that is how we do in our main large application). On the dialog i put a "Print" button and when i click it, I open a crystalreportform and fill the connectioninfo structure and then call SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument). on the Form_closed function, I close database connections and close the report document.
When I come back to mfc application I execute a Delete from table where 1 =0, basically any delete/update that return empty recordset and it throws function sequence error.
BOOL CCrystalDemoDlgDlg::OnInitDialog()
CDialog::OnInitDialog();
ConnectDatabase() ;
return TRUE; // return TRUE unless you set the focus to a control
BOOL CCrystalDemoDlgDlg::ConnectDatabase()
if ( m_Database.IsOpen() )
m_Database.Close();
// Process database open request.
CString szConnection("DSN=CRYSTALTEST32;UID=DBA;PWD=picture");
!m_Database.OpenEx( szConnection, CDatabase::noOdbcDialog ) )
return TRUE;
BOOL CCrystalDemoDlgDlg::bExecuteSQL( CString SqlString )
if(m_Database.IsOpen())
m_Database.ExecuteSQL( (LPCTSTR)SqlString );
return TRUE;
void CCrystalDemoDlgDlg::OnBnClickedBtnPrint()
TRY
bExecuteSQL(_T("DELETE FROM TMPRPT WHERE 1=0"));
CrystalReportsForm ^ CRForm = gcnew CrystalReportsForm(gcnew System::String("ActvSumm1.rpt"));
CRForm->ShowDialog();
//CRForm->RunCrystalReports();
delete CRForm;
CRForm = nullptr;
bExecuteSQL(_T("DELETE FROM TMPRPT WHERE 1=0"));
CATCH(CDBException, e)
AfxMessageBox( e->m_strError );
return ;
END_CATCH
the following is the code in crystalreports library
namespace CR2008Library
public partial class CrystalReportsForm : Form
private ReportDocument _reportDocument;
private string _reportFile = "C:\\Nomadic\\Report\\";
public CrystalReportsForm(string reportFile)
InitializeComponent();
_reportDocument = CreateReportDocument(reportFile);
private ReportDocument CreateReportDocument(string reportFile)
ReportDocument newDocument = new ReportDocument();
_reportFile += reportFile;
newDocument.Load(_reportFile);
return newDocument;
public void ConfigureCrystalReports()
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "CRYSTALTEST";
connectionInfo.UserID = "DBA";
connectionInfo.Password = "picture";
connectionInfo.ServerName = "CRYSTALTEST32";
SetDBLogonForReport(connectionInfo, _reportDocument);
crystalReportViewer.ReportSource = _reportDocument;
private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
public void CrystalReportForm_Load(object sender, EventArgs e)
ConfigureCrystalReports();
private void CrystalReportsForm_FormClosed(object sender, FormClosedEventArgs e)
DisposeCR();
private void DisposeCR()
// Clean up by closing and disposing of the ReportDocument object
if (_reportDocument != null)
if (_reportDocument.Database.Tables.Count > 0)
Tables tables = _reportDocument.Database.Tables;
foreach (Table table in tables)
table.Dispose();
_reportDocument.Database.Dispose();
_reportDocument.Close();
_reportDocument.Dispose();
_reportDocument = null;
I have the log file which doesn't show any error in crystalreports library. I am giving some of the log file for your reference to see what's happening while exiting from crystal and executing the problem sql
CrystalDemoDlg 16c8-e8c EXIT SQLFetch with return code 0 (SQL_SUCCESS)
HSTMT 00F41CC0
CrystalDemoDlg 16c8-e8c ENTER SQLFetch
HSTMT 00F41CC0
CrystalDemoDlg 16c8-e8c EXIT SQLFetch with return code 100 (SQL_NO_DATA_FOUND)
HSTMT 00F41CC0
CrystalDemoDlg 16c8-e8c ENTER SQLCloseCursor
SQLHSTMT 00F41CC0
CrystalDemoDlg 16c8-e8c EXIT SQLCloseCursor with return code 0 (SQL_SUCCESS)
SQLHSTMT 00F41CC0
CrystalDemoDlg 16c8-e8c ENTER SQLFreeHandle
SQLSMALLINT 3 <SQL_HANDLE_STMT>
SQLHANDLE 00F41CC0
CrystalDemoDlg 16c8-e8c EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 3 <SQL_HANDLE_STMT>
SQLHANDLE 00F41CC0
CrystalDemoDlg 16c8-e8c ENTER SQLDisconnect
HDBC 00F427A0
CrystalDemoDlg 16c8-e8c EXIT SQLDisconnect with return code 0 (SQL_SUCCESS)
HDBC 00F427A0
CrystalDemoDlg 16c8-e8c ENTER SQLFreeHandle
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 00F427A0
CrystalDemoDlg 16c8-e8c EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 2 <SQL_HANDLE_DBC>
SQLHANDLE 00F427A0
CrystalDemoDlg 16c8-e8c ENTER SQLFreeHandle
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 00F42718
CrystalDemoDlg 16c8-e8c EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS)
SQLSMALLINT 1 <SQL_HANDLE_ENV>
SQLHANDLE 00F42718
CrystalDemoDlg 16c8-a34 ENTER SQLAllocStmt
HDBC 00F419A0
HSTMT * 0012E2C4
CrystalDemoDlg 16c8-a34 EXIT SQLAllocStmt with return code 0 (SQL_SUCCESS)
HDBC 00F419A0
HSTMT * 0x0012E2C4 ( 0x00f41cc0)
CrystalDemoDlg 16c8-a34 ENTER SQLSetStmtOption
HSTMT 00F41CC0
UWORD 0 <SQL_QUERY_TIMEOUT>
SQLPOINTER 0x0000000F
CrystalDemoDlg 16c8-a34 EXIT SQLSetStmtOption with return code 0 (SQL_SUCCESS)
HSTMT 00F41CC0
UWORD 0 <SQL_QUERY_TIMEOUT>
SQLPOINTER 0x0000000F (BADMEM)
CrystalDemoDlg 16c8-a34 ENTER SQLExecDirectW
HSTMT 00F41CC0
WCHAR * 0x03A30458 [ -3] "DELETE FROM TMPRPT WHERE 1=0\ 0"
SDWORD -3
CrystalDemoDlg 16c8-a34 EXIT SQLExecDirectW with return code 100 (SQL_NO_DATA_FOUND)
HSTMT 00F41CC0
WCHAR * 0x03A30458 [ -3] "DELETE FROM TMPRPT WHERE 1=0\ 0"
SDWORD -3
CrystalDemoDlg 16c8-a34 ENTER SQLNumResultCols
HSTMT 00F41CC0
SWORD * 0x0012E2B8
CrystalDemoDlg 16c8-a34 EXIT SQLNumResultCols with return code -1 (SQL_ERROR)
HSTMT 00F41CC0
SWORD * 0x0012E2B8
DIAG [S1010] [Microsoft][ODBC Driver Manager] Function sequence error (0)
CrystalDemoDlg 16c8-a34 ENTER SQLErrorW
HENV 00F418D8
HDBC 00F419A0
HSTMT 00F41CC0
WCHAR * 0x0012DE00 (NYI)
SDWORD * 0x0012E224
WCHAR * 0x0012DE20
SWORD 511
SWORD * 0x0012DE14
CrystalDemoDlg 16c8-a34 EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 00F418D8
HDBC 00F419A0
HSTMT 00F41CC0
WCHAR * 0x0012DE00 (NYI)
SDWORD * 0x0012E224 (0)
WCHAR * 0x0012DE20 [ 56] "[Microsoft][ODBC Driver Manager] Function sequence error"
SWORD 511
SWORD * 0x0012DE14 (56)
CrystalDemoDlg 16c8-a34 ENTER SQLErrorW
HENV 00F418D8
HDBC 00F419A0
HSTMT 00F41CC0
WCHAR * 0x0012DE00 (NYI)
SDWORD * 0x0012E224
WCHAR * 0x0012DE20
SWORD 511
SWORD * 0x0012DE14
I know that my post is too long, but i would like to give enough information for you to see what's happening. I use visual studio 2008 with crystal library 2008.
Thanks,
Lavanya. -
ORA-31202: DBMS_LDAP: LDAP client/server error: Invalid credentials
Hey Guys,
I have an application with LDAP authentication and a custom login page (pg 101). When I run this app, the login page displays first, logs me in and logs out fine. However, when I branch to this application from another application, the login page shows up with the following error:
ORA-31202: DBMS_LDAP: LDAP client/server error: Invalid credentials
Error ERR-1082 Error in executing authorization scheme code.
I looked at debug and this is happening because when this page is loaded, it goes to my authentication scheme and tries to authenticate me even though I havnt logged in and because no user exists at this point the error happens.
I have set the login page to 'Page is Public' and have also used the following code in the authentication scheme's Page Sentry Function:
IF APEX_CUSTOM_AUTH.CURRENT_PAGE_IS_PUBLIC = TRUE THEN;
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
Any ideas of how I can stop my login page from being authenticated? Or where I am going wrong
Thanks
-MarkJes,
I could get it work !!!! my complete code
DECLARE
l_attributes wwv_flow_global.vc_arr2;
l_attribute_values wwv_flow_global.vc_arr2;
l_msg dbms_ldap.message;
l_entry DBMS_LDAP.message;
l_session DBMS_LDAP.session;
l_ber_element DBMS_LDAP.ber_element;
l_attr dbms_ldap.string_collection;
l_attr_name VARCHAR2(256);
l_vals DBMS_LDAP.string_collection;
retval PLS_INTEGER;
BEGIN
l_session := DBMS_LDAP.init('server', '389');
retval := DBMS_LDAP.simple_bind_s(l_session,'cn=myid,cn=na', 'mypwd');
dbms_output.put_line('Retval -> ' || retval);
l_attr(1) := '*'; -- retrieve all attributes
retval := DBMS_LDAP.search_s(
ld => l_session,
base => 'ou=xx,o=xx',
scope => DBMS_LDAP.SCOPE_SUBTREE,
filter => 'uid=myid',
attrs => l_attr,
attronly => 0,
res => l_msg);
dbms_output.put_line('Retval 2 -> ' || retval);
dbms_output.put_line('msg : ' || l_msg);
IF DBMS_LDAP.count_entries(ld => l_session, msg => l_msg) > 0 THEN
-- Get all the entries returned by our search.
l_entry := DBMS_LDAP.first_entry(ld => l_session,
msg => l_msg);
<< entry_loop >>
WHILE l_entry IS NOT NULL LOOP
-- Get all the attributes for this entry.
DBMS_OUTPUT.PUT_LINE('---------------------------------------');
l_attr_name := DBMS_LDAP.first_attribute(ld => l_session,
ldapentry => l_entry,
ber_elem => l_ber_element);
<< attributes_loop >>
WHILE l_attr_name IS NOT NULL LOOP
-- Get all the values for this attribute.
l_vals := DBMS_LDAP.get_values (ld => l_session,
ldapentry => l_entry,
attr => l_attr_name);
<< values_loop >>
FOR i IN l_vals.FIRST .. l_vals.LAST LOOP
DBMS_OUTPUT.PUT_LINE('ATTIBUTE_NAME: ' || l_attr_name || ' = ' || SUBSTR(l_vals(i),1,200));
END LOOP values_loop;
l_attr_name := DBMS_LDAP.next_attribute(ld => l_session,
ldapentry => l_entry,
ber_elem => l_ber_element);
END LOOP attibutes_loop;
l_entry := DBMS_LDAP.next_entry(ld => l_session,
msg => l_entry);
END LOOP entry_loop;
END IF;
retval := DBMS_LDAP.unbind_s(l_session);
END;
thank you :D
Maybe you are looking for
-
I've updated my iPhone 4S with the latest iOS 6 but battery life had never improved as I expected. A friend of my had recently replace his iPhone 3GS with iPhone 5 and both us compared our simillar daily usage of browsing, emails with attachments (wo
-
Can no longer open email PDF attachment in iBooks
Just discovered can no longer open on iPad mini any email attachment PDF file in iBooks. Cannot tap attachment and select open in iBooks. PDF attachment opens itself automatically on the body of the email. Is this a PDF problem or iPad problem or iB
-
Processing error occured in the source system
Hi Experts, I am extracting payroll data from ECC 5.0 to BW side, after the extraction I'm getting warning message proceesing error in the source system. In the source system apllication log the following warning message displyed. <u>No assignment of
-
CommandButton's Action method doesn't work
Hi all My English isn't very good I use jdeveloper 11.1.1.3.0 I have SelectOneRadio with two options. When I select each option two PanelGroupLayouts' visible should change: <af:selectOneRadio id="sor1" layout="horizontal" binding="#{Bean1.sor_Value}
-
AD Authentication Not Working From Unix
I am implemeting sp3 for my custom built Java application where I am using AD authentication. I tested everything in Windows environment and is working fine but same code when running from UNIX server, it is throwing below error. KrbException: Identi