IllegalStateException Keep Alive Connection not initialized

Dear all,
I would like to solicit for some helpful hints. I have a small midlet running under the WTK22 emulator just fine on my dev machine.
However, on another machine, I get the following exception:
Exception in thread "main" java.lang.IllegalStateException: KeepAliveConnection not initialized
at com.sun.kvem.environment.KeepAliveConnection.run(Unknown Source)
at com..sun.kvem.environment.EmulatorWrapper.main(Unknown Source)
While there are few reports of this nature, I can't seem to find any answers on the net.
I'm using Windows XP, with WTK22 on both environments. On both environments, all the demos seem to run fine.
Any helpful comments would be welcome.
Thanks.
KHK

I get the same issue with WTK2.2 under FC5 64bit Linux. Any ideals about what is causing this??
Thanks

Similar Messages

  • Weblogic proxy plugin closes keep-alive connections to clients randomly

    In short we have following arhitecture:
    clients ---> wl proxy plugin 1 ----> weblogic 1
    clients ---> wl proxy plugin 2 ----> weblogic 2
    Beacuse of the application/installation specific requirements, we are not using failover, one wl proxy always forwards requests to one weblogic (simple configuration).
    Application is TR-069 protocol based (SOAP over HTTP) so it very much relays on persistence TCP connections (Connection: keep-alive). This TCP persistence has to work correctly in order that TR-069 messages are exchanged in required order, otherwise we have a error on application layer.
    Here and there we've noticed applications errors which suggest that we have some problems in TCP connection between the client and the weblogic server. After sniffing, we've noticed that weblogic proxy plugin (Apache) randomly, or because of some other reason we do not know, decides to close TCP connection to client, even app on weblogic did not request so ???
    As a result, client opens new connection to the server with new TR-069 session and it gets bounced beacuse it allready has one open on weblogic server.
    We've sniffed, traced everything we could, we were searching for patterns in time, etc... but we can not find the reason why proxy plugin decides to close the connection to the client (not to the weblogic server).
    Trace (replaced sensitive information):
    Thu Apr 29 15:05:50 2010 <958012725463463784> URL::parseHeaders: CompleteStatusLine set to [HTTP/1.1 200 OK]
    Thu Apr 29 15:05:50 2010 <958012725463463784> URL::parseHeaders: StatusLine set to [200 OK]
    Thu Apr 29 15:05:50 2010 <958012725463463784> parsed all headers OK
    Thu Apr 29 15:05:50 2010 <958012725463463784> sendResponse() : r->status = '200'
    Thu Apr 29 15:05:50 2010 <958012725463463784> canRecycle: conn=1 status=200 isKA=1 clen=545 isCTE=0
    Thu Apr 29 15:05:50 2010 <958012725463463784> closeConn: pooling for '$IP$/$PORT$'
    Thu Apr 29 15:05:50 2010 <958012725463463784> request [$URL$] processed successfully..................
    !!!! Now it closes the TCP connection and inserts "Connection: close" HTTP header !!!
    WL proxy plugin conf params are:
    WebLogicCluster $IP$:$PORT$
    DynamicServerList OFF
    KeepAliveTimeout 90
    MaxKeepAliveRequests 0
    KeepAliveSecs 55
    Apache worker configuration is:
    <IfModule mpm_worker_module>
    PidFile var/run/httpd-worker.pid
    LockFile var/run/accept-worker.lock
    StartServers 2
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadLimit 200
    ThreadsPerChild 200
    MaxClients 2000
    MaxRequestsPerChild 0
    AcceptMutex pthread
    </IfModule>
    Why weblogic proxy plugin ignores Keep-alive directive and decides to close connection to the client by itself?
    Any help?

    If a WebLogic Server instance listed in either the WebLogicCluster parameter or a dynamic cluster list returned from WebLogic Server fails, the failed server is marked as "bad" and the plug-in attempts to connect to the next server in the list.
    MaxSkipTime sets the amount of time after which the plug-in will retry the server marked as "bad." The plug-in attempts to connect to a new server in the list each time a unique request is received (that is, a request without a cookie).
    Note: The MaxSkips parameter has been deprecated as the MaxSkipTime parameter.
    See also here: http://download-llnw.oracle.com/docs/cd/E13222_01/wls/docs81/plugins/plugin_params.html
    You said the problem arises under significant load. Maybe, it is wise to tune the number file descriptor's on your operating system. HTTP connections are nothing more than TCP sockets on the operating system. All modern operating systems treat sockets as a specialized form of file access and use data structures called file descriptors to track open sockets and files for an operating system process. To control resource usage for processes on the machine, the operating system restricts the number of open file descriptors per process. You should be aware that all TCP connections that have been gracefully closed by an application will go into what is known as the TIME_WAIT state before being discarded by the operating system.
    On most unix systems you can use netstat -a | grep TIME_WAIT | wc -l to detemine the number of socket in time_wait state. You have to check with your system adminstrator how to tune the tcp_time_wait_interval. On solaris you can use: /usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000

  • LDAP keep-alive connection ? (use of ldap_io_fns)

    Hi there,
    I am facing a new req. from network security guys that want to close 'idle' connections that crosses firewalls. But as I do use persistent search connection which are not very 'busy' => i.e. not enough traffic to be kept open by FireWall rule.
    Consequence my client could not 'detect' this cut of connection and do not receive any more the 'updates' through persistent search.
    I am now trying to init my connection setting optional io_fns structure changing the socket func by my socket func that do create a keep-alive socket.
    But it does not bind properly ... Init seem ok but bind never get out. LDAP receives bind and do log it but seem not able to respond properly ...
    Any idea on how to use this io_fns struct ?
    Many thanks.
    Hedi.
    .

    the problem is not that process is in foreground or background: the problem is the timeout: I need to avoid timeout, because the idea is to launch the report and then go out for lunch So I need to find a way in the code to advise the system that user has not to be logged out.
    Thanks
    Gabriele

  • Keep-alive connection between app and servlet

    Hi,
    I have searched the forum for information about how to keep a
    connection alive between a client app and a servlet, but I have not been
    able to find anything.
    Does someone have an example of how to do this? Please send it!
    Thanks!

    HTTP connections are transient, they're not meant to be kept open.
    HTTP 1.1 can support this feature, check the RFC and servlet specification (and probably the appserver documentation for configuration).
    Best use another protocol though, ftp for example (or something else entirely).

  • Keep alive connection

    Hi,
    I write a report that works on a lot of data and when it starts, it takes about an hour or two for processing. The problem is that on the system there is a timout of 20 minutes of inactivity after which the use il logged out.
    The question is: is there a way by code to advise a sort of keep alive so that user is not logged out?
    (I can't change the timeout on the system for security issues)
    Thanks
    Gabriele

    the problem is not that process is in foreground or background: the problem is the timeout: I need to avoid timeout, because the idea is to launch the report and then go out for lunch So I need to find a way in the code to advise the system that user has not to be logged out.
    Thanks
    Gabriele

  • Keep-alive message bridge connection

    Hi,
    I have setup messaging bridge between WLS 10.3.0.0 and a JBoss Messaging queque, after about 4 hours of inactivity in a queue bridge was disconneted, is there any way to configure keep-alive connection in WLS bridge ?
    Thanks,
    Lukasz

    You can try to set the IdleTimeMaximum setting on your bridge configuration to a very large number. It specifies the maximum amount of time, in seconds, that a messaging bridge instance remains idle.
    In “asynchronous” mode, this is the longest amount of time a messaging bridge instance stays idle before it checks the sanity of its connection to the source. In “synchronous” mode, this is the amount of time the messaging bridge can block on a receive call if no transaction is involved.
    -Dongbo

  • GRE VPN & KEEP ALIVE

    Dear all,
    i am having problem with make keep alive connectivity all the time between 2 nodes.
    I have A and B cisco routers established GRE VPN over ISP. Problem starts with when there are no active connection from host of A to host of B. It looks like  VPN down. Another problem is when A 's having temp power outage and when power comes there is no active connection even WAN protocol is down.When reload A router manually then connection comes up.
    I am thinking that maybe some configuation like keep alive retry something like that.
    Do guys have any idea on this matter ?

    GRE tunnels are usually used in combination with a dynamic routing protocol that keeps the tunnel up and active. If you are using static routes there is no traffic to keep the tunnels up when the applications are not transmitting.
    You have two options:
    1. Increase the isakmp/ipsec lifetimes.
    http://www.cisco.com/en/US/products/sw/iosswrel/ps1831/products_configuration_guide_chapter09186a00800d981f.html#1001095
    2. Setup keepalives (Best Option)
    crypto isakmp keepalive (Number of seconds between keep alives) (Number of seconds between retries if keepalive fails)

  • HttpConnection keep-alive

    Hello!
    Guys i need your help to create a connection to web server with DataOutputStream and DataInputStream.
    The problem is that I need to create connection that can be open all the time and I can write and read data from server.
    I had make some variant but it's working only first time, after it say's connection already open.
    here are code, little bit different, now it says Write attempted after request finished
    here is source code
    package super_7_blackjack;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    public class HTTPQuery {
            private HttpConnection connection;
            private DataOutputStream dos;
            private DataInputStream dis;
            private String URL;
            private String sessionId;
            public HTTPQuery(String URL, String sessionId) {
                System.out.println("URL=" + URL);
                this.URL = URL;
                this.sessionId = sessionId;
                try {
                    connection = (HttpConnection)Connector.open(URL);
                    connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
                    connection.setRequestProperty("cookie","JSESSIONID=" + sessionId + "; AnyJavaPresent=1.4.2_05");
                    connection.setRequestProperty("Cache-Control","no-cache");
                    connection.setRequestProperty("Pragma","no-cache");
                    connection.setRequestProperty("User-Agent","Mozilla/4.0 (Windows XP 5.1) Java/1.4.2_05");
                    connection.setRequestProperty("Accept","text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
                    connection.setRequestProperty("Connection","keep-alive");
                    connection.setRequestMethod("POST");
                    if( connection.getResponseCode() == HttpConnection.HTTP_OK ) {
                        dos = new DataOutputStream(connection.openOutputStream());
                        dis = new DataInputStream(connection.openInputStream());
                } catch (IOException ieox) {
                 System.out.println("Error while opening connection.");
         public synchronized String executeRequestQuery(String query) {
              StringBuffer b = new StringBuffer();
              long len = 0;
              try {
                   dos.write(query.getBytes());
                   dos.flush();
                   DataInputStream dis = new DataInputStream(connection.openInputStream());
                   len = connection.getLength();
                   if (len!=-1) {
                                byte servletData[] = new byte[(int)len];
                                dis.readFully(servletData);
                                b.append(new String(servletData));
                             } catch (Exception e) {
                        System.out.println("Error while closing: "  + e.getMessage());
              System.out.println(b.toString());
              return b.toString();
    }and I use it
    httpQuery = new  HTTPQuery(URL,sessionId);
    httpQuery.executeRequestQuery("CREATESESSION=NO&CMD=ENTER&DBLINK=DBLINKFREE1");

    jhd
    package super_7_blackjack;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    public class HTTPQuery {
            private HttpConnection connection;
            private DataOutputStream dos;
            private DataInputStream dis;
            private String URL;
            private String sessionId;
            public HTTPQuery(String URL, String sessionId) {
                System.out.println("URL=" + URL);
                this.URL = URL;
                this.sessionId = sessionId;
                try {
                    connection = (HttpConnection)Connector.open(URL);
                    connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
                    connection.setRequestProperty("cookie","JSESSIONID=" + sessionId + "; AnyJavaPresent=1.4.2_05");
                    connection.setRequestProperty("Cache-Control","no-cache");
                    connection.setRequestProperty("Pragma","no-cache");
                    connection.setRequestProperty("User-Agent","Mozilla/4.0 (Windows XP 5.1) Java/1.4.2_05");
                    connection.setRequestProperty("Accept","text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
                    connection.setRequestProperty("Connection","keep-alive");
                    connection.setRequestMethod("POST");
                    if( connection.getResponseCode() == HttpConnection.HTTP_OK ) {
                        dos = new DataOutputStream(connection.openOutputStream());
                        dis = new DataInputStream(connection.openInputStream());
                } catch (IOException ieox) {
                 System.out.println("Error while opening connection.");
         public synchronized String executeRequestQuery(String query) {
              StringBuffer b = new StringBuffer();
              long len = 0;
              try {
                                                               dos = new DataOutputStream(connection.openOutputStream());
                   dos.write(query.getBytes());
                   dos.flush();
                   DataInputStream dis = new DataInputStream(connection.openInputStream());
                   len = connection.getLength();
                   if (len!=-1) {
                                byte servletData[] = new byte[(int)len];
                                dis.readFully(servletData);
                                b.append(new String(servletData));
                             } catch (Exception e) {
                        System.out.println("Error while closing: "  + e.getMessage());
              System.out.println(b.toString());
              return b.toString();
    dos.close();
    dis.close();
    }see in block latter what you need to change is>>>>
    this will not going to close your HttpConnection but it will close only ur Stream connection and that will not required never at all.
    try with this code i hope this will helps you.
    Regards,
    Jasmit vala
    [email protected]

  • Http connection not working on phone

    Hi i am trying to connect to a http server using the new nokia n95 phone with T-mobile web and walk(Unlimited 3g internet access)
    on the emulaor and on the phones wifi connection, it works. But when i try connecting to the server using gprs/3g it doesnt. The response code never equals to OK . here is my code below:
    I know it is not working because has soon as the program makes an attempted to connect, the root.notifyDestroy() closes the application as i expect it too
    server = (HttpConnection) Connector.open(url);
                server.setRequestMethod(HttpConnection.POST);
                int rc = server.getResponseCode();
                if (rc == HttpConnection.HTTP_OK)
                   is = server.openInputStream();
                else
                    root.notifyDestroyed();
                     Alert alert = new Alert ("Error");
                    alert.setString("Error, server is down");
                    alert.setTimeout (5000);
                    Display.getDisplay(root).setCurrent(alert);
                    throw new IOException("HTTP response code: " + rc);
                }

    I had all sorts of strange problems getting http connect to work from phones. Most of my problems were resolved by adding every single header I could find that tells the carrier's gateway to leave it alone. Try adding these headers to the connection from the phone, and the response from the server:
                        connection.setRequestProperty( "User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
                        connection.setRequestProperty( "Content-Type", "application/octet-stream");
                        connection.setRequestProperty( "Content-Length", ""+(allContentToSend.length));
                        connection.setRequestProperty( "Cache-Control","no-store");
                        connection.setRequestProperty( "Cache-Control", "no-cache");
              connection.setRequestProperty( "Pragma","no-cache");
              connection.setRequestProperty( "Cache-Control", "no-transform");
              connection.setRequestProperty( "Connection", "Keep-Alive");
              connection.setRequestProperty( "Proxy-Connection", "Keep-Alive");          
    The content-type will depend on what you are sending. octet-stream is for binary data. If you are just encoding parameters in your POST you may need something else like "application/x-www-form-urlencoded".
    The content-length is obviously dependant on what you are sending. The rest of the properties simply tell whoever is transporting the request to leave it alone.
    TEMP_MOVED sounds like a redirect or some odd thing. Maybe the carrier is caching the response, and you are actually getting something unnexpected.
    Hope this helps.

  • GF3.0 - Enabling HTTP keep-alive?

    In GF 2.0, there's a handy-dandy tab on the HTTP Listener configs for enabling and configuring HTTP keep-alives. In GF 3.0, there is not.
    I've been combing various sites and blogs and docs and have been unable to find any information on enabling HTTP keep-alives. Some data I've found seems to suggest that raising the Max Connections and Timeout values for the listener to values greater than 1 implicitly enables keep-alives, but if I test the server with AB it shows zero keep-alive requests.
    Any help that anyone could provide would be greatly appreciated.

    [glassfish@appserver ~]$ asadmin get -m \*keep-alive.\*count
    Enter admin user name> admin
    Enter admin password for user "admin">
    Command get executed successfully.
    [glassfish@appserver ~]$ asadmin get "server\*keep-alive.\*"
    Enter admin user name> admin
    Enter admin password for user "admin">
    com.sun.enterprise.admin.cli.CommandException: remote failure: Dotted name path server\*keep-alive.\* not found.
    Command get failed.

  • Is it best practice to use a dedicated link between NX7K pair for keep-alive?

    I have been using dedicated physical 10G link between pair of NX7k for keep-alive. Is it a best practice? It seems a waste of 10G ports because keep-alives does not need that much bandwidth.
    I'm thinking just configure a dedicated VLAN interface in the default VRF, and have it routed through other devices (fir example 6509 core switches) for keep-alive. Has anyone done that before? The goal is not to use dedicated 10G ports for keep-alive.
    Thanks a lot.

    gwhuang5398 wrote:I have been using dedicated physical 10G link between pair of NX7k for keep-alive. Is it a best practice? It seems a waste of 10G ports because keep-alives does not need that much bandwidth.I'm thinking just configure a dedicated VLAN interface in the default VRF, and have it routed through other devices (fir example 6509 core switches) for keep-alive. Has anyone done that before? The goal is not to use dedicated 10G ports for keep-alive.Thanks a lot.
    I agree that using a Tengig port for this purpose is not efficient. The whole idea of peer-keepalive is to have a way to avoid split brain scenarios in case of peer-link failure. For this reason the peer-keepalives should never cross the peer-link as it defeats the original purpose I just cited. Following are some viable options:
    You can use the N7K management ports for peer-keepalive functionality. If you have redundant supervisors then make sure you use an external switch (OOB switch for example) to patch the management ports.
    You can use dedicated interfaces just like you are doing right now but that would make more sense if you had Gig ports in my opinion.
    You can run peer-keepalives inband but you need to make sure this traffic is never routed over the peer-link. It is considered a good practice to use a dedicated VRF for this purpose.
    Atif

  • URLConnection POST to external server requiring keep-alive fails because request is HTTP/1.0

              I have a class that when run as a "main" transmits a HTTP/1.1 post successfully
              to an external server. This external server requires keep-alive connections.
              However when instantiated inside a weblogic servlet container, the post fails
              because the HTTP protocol is set to HTTP/1.0. I have tried this with V5.1 SP11
              and then with V6.1 SP2 with the same result. The code works under Tomcat.
              I can find no way to force HTTP/1.1 in the URLConnection. Any suggestions?
              

    Great. I have a question to BEA folks, if they ever read this newsgroup:
              what is the reason for installing WLS protocol handlers, and, if there is
              one, why the implementation is still buggy? I saw many, many instances when
              code making outgoing connections failed to work in WLS, and the solution is
              always the same - use handler which comes with the JVM.
              Bob Bowman <[email protected]> wrote:
              > <[email protected]> wrote:
              >>If it works as a standalone application and fails inside WebLogic, most
              >>likely this
              >>is caused by WebLogic http handler implementation. You can try to modify
              >>your code
              >>like this:
              >>
              >>URL url = new URL(null, "http://some_url", new sun.net.www.protocol.http.Handler());
              >>HttpURLConnection conn = (HttpURLConnection)url.openConnection();
              >>
              >>(you will need to modify weblogic.policy to allow your code to specify
              >>protocol
              >>handler).
              >>
              >>Bob Bowman <[email protected]> wrote:
              >>
              >>> I have a class that when run as a "main" transmits a HTTP/1.1 post
              >>successfully
              >>> to an external server. This external server requires keep-alive connections.
              >>> However when instantiated inside a weblogic servlet container, the
              >>post fails
              >>> because the HTTP protocol is set to HTTP/1.0. I have tried this with
              >>V5.1 SP11
              >>> and then with V6.1 SP2 with the same result. The code works under
              >>Tomcat.
              >>
              >>> I can find no way to force HTTP/1.1 in the URLConnection. Any suggestions?
              >>
              >>--
              >>Dimitri
              > Worked like a champ! Thanks.
              Dimitri
              

  • Speed limit on pipelining keep-alive requests?

    Hi all,
              I was wondering if anyone knows of a limit in how fast weblogic can
              handle multiple servlet requests over a keep-alive connection.
              We were trying to throw a bunch for testing purposes, and it seems that
              if we bunch them closer together than ~300ms, it won't handle more than
              two. (I can recreate the problem by hand, too)
              Is this a limit in Weblogic 6?
              Thanks,
              Dave
              ps: here's the exception trace:
              <Mar 5, 2001 4:15:53 PM EST> <Error> <Posix Performance Pack> <Uncaught
              Throwable in processSockets
              java.lang.NullPointerException
              at weblogic.socket.TunnelContext.getServlet(TunnelContext.java:24)
              at weblogic.servlet.internal.MuxableSocketHTTP.dispatch(MuxableSocketHTT
              P.java:459)
              at
              weblogic.socket.PosixSocketMuxer.deliverGoodNews(PosixSocketMuxer.jav
              a:449)
              at
              weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java
              :378)
              at
              weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
              23)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              

    Hi all,
              I was wondering if anyone knows of a limit in how fast weblogic can
              handle multiple servlet requests over a keep-alive connection.
              We were trying to throw a bunch for testing purposes, and it seems that
              if we bunch them closer together than ~300ms, it won't handle more than
              two. (I can recreate the problem by hand, too)
              Is this a limit in Weblogic 6?
              Thanks,
              Dave
              ps: here's the exception trace:
              <Mar 5, 2001 4:15:53 PM EST> <Error> <Posix Performance Pack> <Uncaught
              Throwable in processSockets
              java.lang.NullPointerException
              at weblogic.socket.TunnelContext.getServlet(TunnelContext.java:24)
              at weblogic.servlet.internal.MuxableSocketHTTP.dispatch(MuxableSocketHTT
              P.java:459)
              at
              weblogic.socket.PosixSocketMuxer.deliverGoodNews(PosixSocketMuxer.jav
              a:449)
              at
              weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java
              :378)
              at
              weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
              23)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              

  • GetHttpRequestData & Expired Keep-Alive

    I am using the gethttprequestdata() function in CF8 on a
    windows 2k3 server to parse submitted form variables with
    gethttprequestdata().content part of the struct returned (I am
    using a 404 framework with IIS and it is the only way I know to get
    the posted form variables back). When the browser's keep-alive has
    not elapsed the function works fine and returns all the post
    variables in gethttprequestdata().content, however when this time
    is exceeded... gethttprequestdata().content is empty even though
    the post passed arguments. This happens in any browser. I have been
    waiting 5 minutes between requests and it occurs every time.
    Anyone know how to get around this?

    Also, I forgot to mention that
    gethttprequestdata().headers.content-length does have the correct
    length even though gethttprequestdata().content is empty.

  • Please Help - To keep LDAP connection alive

    Hi,
    I have used the below function to communicate with LDAP which I have taken and modified from one of the posts in this forum.
    My issue is, each time the function opens a connection, search and closing the connection and its seriously affects the performance.
    I hope we can resolve this by keeping the connection alive. As I am new to this concept, I am not sure how to do this.
    It would be great, if some one help me to keep the connection alive for the below function. Thanks in advance.
    create or replace FUNCTION <name> (loginname VARCHAR2)
    RETURN NUMBER
    IS
    -- Adjust as necessary.
    l_ldap_host VARCHAR2(256) := '';
    l_ldap_port VARCHAR2(256) := '';
    l_ldap_user VARCHAR2(256) := '';
    l_ldap_passwd VARCHAR2(256) := '';
    l_ldap_base VARCHAR2(256) := '';
    l_retval PLS_INTEGER;
    l_session DBMS_LDAP.session;
    l_attrs DBMS_LDAP.string_collection;
    l_message DBMS_LDAP.message;
    l_filter varchar2(35):='xxxx='|| loginname;
    l_count NUMBER:=0;
    BEGIN
    -- Choose to raise exceptions.
    DBMS_LDAP.USE_EXCEPTION := TRUE;
    -- Connect to the LDAP server.
    l_session := DBMS_LDAP.init(hostname => l_ldap_host,portnum => l_ldap_port);
    l_retval := DBMS_LDAP.simple_bind_s(ld => l_session,dn => l_ldap_user,passwd => l_ldap_passwd);
    -- Get attribute
    l_attrs(1) := 'xxxx';
    l_retval := DBMS_LDAP.search_s(ld => l_session, base => l_ldap_base, scope => DBMS_LDAP.SCOPE_SUBTREE, filter => l_filter, attrs => l_attrs, attronly => 0, res => l_message);
    l_count:=DBMS_LDAP.count_entries(ld => l_session, msg => l_message);
    -- Disconnect from the LDAP server
    l_retval := DBMS_LDAP.unbind_s(ld => l_session);
    return l_count;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error :'||SQLERRM);
    return 0;
    END <fun name>;
    Thanks,
    Praveen
    Edited by: 920577 on Mar 13, 2012 9:40 AM
    Edited by: 920577 on Mar 13, 2012 9:41 AM

    The basic template looks as follows:
    SQL> create or replace package Foo as
      2 
      3  procedure LdapLogoff;
      4  function GetData( empName varchar2 )  return number;
      5 
      6  end;
      7  /
    Package created.
    SQL>
    SQL> create or replace package body Foo as
      2 
      3  isLoggedOn boolean;
      4 
      5  procedure LdapLogon is
      6  begin
      7          DBMS_OUTPUT.put_line( '..running logon()' );
      8          isLoggedOn := true;
      9  end;
    10 
    11  procedure LdapLogoff is
    12  begin
    13          DBMS_OUTPUT.put_line( '..running logoff()' );
    14          isLoggedOn := false;
    15  end;
    16 
    17  function GetData( empName varchar2 ) return number is
    18  begin
    19          if not isLoggedOn then
    20                  LdapLogon();
    21          end if;
    22         
    23          DBMS_OUTPUT.put_line( '..running GetData() for '||empName );
    24          return(
    25                  round(DBMS_RANDOM.Value(1,100))
    26          );
    27  end;
    28 
    29 
    30  --// main()
    31  begin
    32          DBMS_OUTPUT.put_line( 'Package Foo loaded into memory' );
    33          isLoggedOn := false;
    34  end;
    35  /
    Package body created.
    SQL>
    SQL>
    SQL> select empno, ename, Foo.GetData(ename) as ID from emp order by empno;
         EMPNO ENAME              ID
          7369 SMITH              23
          7499 ALLEN              47
          7521 WARD               88
          7566 JONES              71
          7654 MARTIN             91
          7698 BLAKE              28
          7782 CLARK              92
          7788 SCOTT              91
          7839 KING               48
          7844 TURNER             89
          7876 ADAMS              64
          7900 JAMES              16
          7902 FORD               18
          7934 MILLER             35
    14 rows selected.
    Package Foo loaded into memory
    ..running logon()
    ..running GetData() for SMITH
    ..running GetData() for ALLEN
    ..running GetData() for WARD
    ..running GetData() for JONES
    ..running GetData() for MARTIN
    ..running GetData() for BLAKE
    ..running GetData() for CLARK
    ..running GetData() for SCOTT
    ..running GetData() for KING
    ..running GetData() for TURNER
    ..running GetData() for ADAMS
    ..running GetData() for JAMES
    ..running GetData() for FORD
    ..running GetData() for MILLER
    SQL>
    SQL> select empno, ename, Foo.GetData(ename) as ID from emp where rownum = 1;
         EMPNO ENAME              ID
          7369 SMITH               9
    ..running GetData() for SMITH
    SQL>
    // call Foo.Logoff manually when done, or leave it to
    // Oracle to close and release resources when the
    // session terminates

Maybe you are looking for

  • Problem with mixed CDs

    Most of my CDs have the tracks mixed so there is no break in between songs. I would like to be able to convert these CDs into a single track to keep the flow of the music. Is this possible with iTunes, and if not can someone direct to a program it is

  • Translation Builder an WebForms

    I need to translate my forms in many european languages and I decided to use Translation Builder. Translation Builder, I belive, choose the language using the registry NLS_LANGUAGE parameter. When I try to use it in WebForm I can't change NLS_LANGUAG

  • Changed File Name but reverts to original file name when exported or copied

    I created a folder of 150 photos for a video montage and numbered them all by editing the file name. When I export (or copy and paste) the images to a folder on my desktop, the files all revert back to their original file names. Any ideas?

  • Not able to send texts to other iPhones why?

    MNot able to send texts to other iPhones why?

  • Flash Player/Reader .exe Won't Open

    I attempted to download the new versions of Flash Player and Reader, and I was able to download the .exe files, but when I try to run them, Internet Explorer opens for some reason, and then crashes before displaying a page. After this, the same Windo