Menu

only one connection work?

anan zhang
2008-10-08
2012-09-26
  • anan zhang

    anan zhang - 2008-10-08

    hi.
    i compile the demo application "pool.c" with vc6 and modify it's minconn to 5.
    when i run it, i find five connection with database by firewall,
    but only one connection working.
    and another problem,it's spending too much time during "OCI_ConnPoolGetConnection(data)" ;

    lib COMPILE: win2003 vc2005
    pool.c COMPILE: WIN2003 vc6
    pool.exe RUN: WIN2003
    DB: ORACLE 11G the same as LINUX or WIN2003

     
    • anan zhang

      anan zhang - 2008-10-09

      Hi Vincent.

      I use ocilib 2.5.1 and already set OCI_ENV_THREADED flag.

      It is realy one physical database connection working,

      Shall you email me the compiled pool.exe to me,just let me make a test.

       
      • Vincent Rogier

        Vincent Rogier - 2008-10-09

        Hi,

        Okay, i'll send you an executable later today...

        You can send me as well your project used to compile the pool demo. I'll try to compile it on my config.

        And give me more details :

        Your OS ?
        Your compiler ?
        Your Client version of Oracle ?
        Your Server version of Oracle ?

        Vincent.

         
    • Vincent Rogier

      Vincent Rogier - 2008-10-09

      Sorry, i forgot you already gave versions details...

      Did you configure your projet for mutltithreading in the complier options ??

      Send me the VC6 project file used to the pool demo....

       
    • anan zhang

      anan zhang - 2008-10-09

      Thank you Vincent.
      I have sent the files by your sf email address,Not sure whether you can recived.

       
      • Vincent Rogier

        Vincent Rogier - 2008-10-09

        Hi,

        I got your mail...

        I build your project with VC6.... I had to modify the link reference from ocilib.lib to ociliba.lib

        But when i tested, it ran fine !....

        I saw that in your project setting, you were generating the app test in single thread debug...

        You can modify to multithread.... And check again...

         
    • Nobody/Anonymous

      OH let me check it,
      Thanks again that excuse me for taking your time.

       
    • Vincent Rogier

      Vincent Rogier - 2008-10-08

      Hi Anan,

      > when i run it, i find five connection with database by firewall

      Normal you asked for a pool of 5 connections

      > but only one connection working

      Normal you're using only one connection

      > it's spending too much time during "OCI_ConnPoolGetConnection(data)"

      The first attempt to get a connection from the pool is expensive because 5 connections are physically created by OCI..
      Further call to get a connection will return quicky becauseif you've got connection ready to be used in the pool.

      That's the idea behing 'connection pooling'

      Vincent.

       
    • anan zhang

      anan zhang - 2008-10-08

      Thank you for answer Vincent.

      The problem i can not understood is after the pool created,I create (MAX_THREADS 50) work threads, they are blocked calling OCI_ConnPoolGetConnection API,and only one connection transfer data with database server. and max_conn not reached.

      Just the sql querys on a established connetion can return quickly.

       
      • Vincent Rogier

        Vincent Rogier - 2008-10-08

        Hi,

        What version of ocilb and oracle are you using ?

        Have you passed the flag OCI_ENV_THREADED to OCI_Initialize() ?

         
      • Vincent Rogier

        Vincent Rogier - 2008-10-08

        Hi,

        I've just compiled pool.c on :

        • MS Windows Vista
        • OpenSuse 10

        with :

        • package 2.5.1
        • package 3.0.0

        using 10.2.3 client and server and all tests ran fine...

         
    • Nobody/Anonymous

      That I think whether should remove the mutex from the OCI_ConnPoolGetConnection API.

       
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.