Can you just do it declaratively?
What is the intent behind your request? The book linked in the post describes how to replicate LDAP data using materialized views, which might be handy for what you need.
I already used my own authentication scheme with apex functionality.
For this authentication I used in my code the following:
In the fist step I used hostname and the port.
1. L_SESSION := DBMS_LDAP.INIT(L_LDAP_ADDRESS, L_LDAP_PORT);
After that, I was binding my session using user and password.
2. L_RETVAL := DBMS_LDAP.SIMPLE_BIND_S(L_SESSION,L_LDAP_USER,P_PASSWORD);
This all worked fine with my test-ldap server. But for now I have to initialize the connection with a pwassword and and connectionuser, so that setting up a session is secured also.
So i need something like:
L_SESSION := DBMS_LDAP.INIT(L_LDAP_ADDRESS, L_LDAP_PORT,CONNECTIONNAME,PASSWORD);
Is there a function like that i can use?
My second question:
2. How is it possible to start the LDAP Session with the Application start?
I want two establish the ldpa session once and then use this session for all users tryin to login in my application. Is there a possibility to start an event when my application get started or something?
I would like to start my session I set up with my connection name once I started the application. So I can use this session to handle all user-logins. So i dont have to do DBMS_LDAP.INIT every time i want to log in with an user.
Hope my questions are clear now.
1) I'm not familiar enough with DBMS_LDAP to help you out there, this is the place to go
2) This won't be possible. APEX shares database connections within a pool. If you're after performance benefits - get a copy of the book and read the chapter showing how to replicate data from LDAP using materialised views.