Hi Mike,

Is it like first conn.close() is closing the pool itself instead of
releasing connection back to pool.

Thanks
Suraj

On Thu, 8 Jun 2023 at 18:34, Mike Bayer <mike_not_on_goo...@zzzcomputing.com>
wrote:

> unknown.  I've run your program exactly as written with SQLAlchemy 2.0.15
> and it succeeds on both queries.  I would advise reaching out to
> https://github.com/oracle/python-oracledb/discussions for debugging
> help.   feel free to show them our recipe from
> https://docs.sqlalchemy.org/en/20/dialects/oracle.html#using-oracle-database-resident-connection-pooling-drcp
> for reference.
>
> On Thu, Jun 8, 2023, at 7:23 AM, Suraj Shaw wrote:
>
> Hi Team,
>
> I am using connection pooling in sqlalchemy using oracle own pool.My
> script looks like this.
> ```
> from sqlalchemy import create_engine,text
>
> from sqlalchemy.pool import NullPool
>
> import oracledb
>
> pool = oracledb.create_pool(user='XXX', password='XXX',dsn='XXX:1521/XXX',
> min=1, max=5, increment=1)
>
> def creator():
>
>     return pool.acquire(cclass="MYAPP",purity=oracledb.PURITY_SELF)
>
>
> engine = create_engine("oracle+oracledb://", creator=creator,
> poolclass=NullPool)
>
>
> conn = engine.connect()
>
> result = (conn.execute(text("select current_timestamp from dual")))
>
> for row in result:    #first query
>
>     print(row)
>
> conn.close()
>
>
> conn = engine.connect()
>
> result = (conn.execute(text("select current_timestamp from dual")))
>
> for row in result:     #second query
>
>     print(row)
>
>
> conn.close()
>
> ```
>
>
> Here the first query in running perfectly when the second time when i am
> doing it then it is rasing the folowing error
>
> sqlalchemy.exc.DatabaseError: (oracledb.exceptions.DatabaseError)
> DPY-4011: the database or network closed the connection
>
> Why is this issue coming.
>
> Is it because of conn.close(). Here the conn.close() is not releasing
> connection back to the pool.
>
> Thanks
>
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/10098e90-038e-478e-8a7e-db5b8e2f7e07n%40googlegroups.com
> <https://groups.google.com/d/msgid/sqlalchemy/10098e90-038e-478e-8a7e-db5b8e2f7e07n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/4049c5f7-6369-4251-8de4-b116441fb782%40app.fastmail.com
> <https://groups.google.com/d/msgid/sqlalchemy/4049c5f7-6369-4251-8de4-b116441fb782%40app.fastmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CALW8fqdZxO6h0bsAFGvvwWotNQwMZNZJUyOwL%2B-vfBkiGG0%3DrA%40mail.gmail.com.

Reply via email to