Giter Club home page Giter Club logo

Comments (4)

rsim avatar rsim commented on July 17, 2024

You cannot reuse one plsql connection in many threads - currently there are no thread-safe updates to shared connection data (like cached procedure metadata).

I am not using and testing ruby-plsql in multi-threaded programs and currently do not recommend to do that.

from ruby-plsql.

dherzhau avatar dherzhau commented on July 17, 2024

I use 1 connection per thread,:

thread.times { |i|
threads[i] = Thread.new {
plsql.connection = OCI8.new(user,password,db)

In the given script I try to simulate many user are calling the the same PL/SQL function.
The dbi interface can handle this behavior but I find plsql is nicer to read and write I tried it this way.As well I found nothing regarding thread restrictions in the documentation.

But any way thx for your Info.

from ruby-plsql.

rsim avatar rsim commented on July 17, 2024

When you use plsql.connection = ... in two different threads then it updates the same connection for default plsql connection. If you want to establish separate connections then you need to do e.g. plsql(:one).connection = ... and plsql(:two).connection = ... and then later as well use them like plsql(:one).some_procedure and plsql(:two).other_procedure. When you use plsql.connection = ... then it is the same as plsql(:default).connection = ...

So maybe you can try something like plsql("thread#{i}") to ensure that each thread will have own connection.

from ruby-plsql.

dherzhau avatar dherzhau commented on July 17, 2024

Manny Thx it works now like expected

from ruby-plsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.