Comments (6)
In order to maximize usage, I will execute multiple sql on the same connection.
Please tell me, is this possible, or are there any better improvement measures? thanks!
// initialize ocilib::Pool pool
function (ocilib::Pool pool)
{
auto conn = pool.getConnection();
ocilib::Statement stmt(conn);
if(condition)
{
try
{
stmt.Execute(sql);
conn.Commit();
}
catch (...)
{
conn.Rollback();
std::cerr << "Error in " << EventName << std::endl;
}
}
// Use the same connection
try
{
stmt.Execute(sql2);
conn.Commit();
}
catch (...)
{
conn.Rollback();
std::cerr << "Error in " << EventName << std::endl;
}
//.....
from ocilib.
Hi,
As soon the connection object is out of scope (destructor invoked) and if there is no more reference to the underlying handle, the oracle connection is returned to the pool automatically.
Calling connection::Close() does the same ( in fact the destructor calls Close()).
By default, in case of exhausted pool, Pool::GetConnection() is a blocking call until a connection is available (this behaviour can be changed using Pool::SetNoWait()).
Regards,
Vincent
from ocilib.
If Pool::SetNoWait(TRUE), what happens when the connection resources are exhausted? Will a new connection resource be created? Or return empty? Or something else
from ocilib.
Pool::GetConnection() will raise an exception
from ocilib.
Excuse me, is it possible to establish two ocilib::Pool to connect to different databases respectively? Will there be conflicts?
from ocilib.
Of course you can use different pools to connect to different databases :)
Vincent
from ocilib.
Related Issues (20)
- OCI_RefToText() return garbage when charset is OCI_CHARSET_WIDE HOT 1
- Error occurred at OcilibEnvironmentInitialize: Cannot load OCI shared library (oci.dll) HOT 4
- Error occurred at OcilibResultsetFetchFirst: A null Resultset handle has been provided HOT 5
- Regarding the use of connection pool to obtain links, will it be automatically recycled by connection pool? HOT 1
- I don't know why I suddenly reported this error: ocilib\include\ocilibcpp\detail\exception.hpp(92): error C2061: syntax error: identifier 'nothrow' HOT 1
- Regarding using ocilib::Pool to get links ,what happens if the maximum link is reached? HOT 1
- symbol not found in flat namespace '_OCIAQDeq' (macOS arm64) HOT 3
- Wrapper for OCINlsGetInfo() HOT 1
- On the limitation of the number of preprocessing bindings? HOT 1
- Why does ocilib::Resultset restrict the default construct? HOT 1
- crash with using change notification HOT 1
- Free memory after dequeue HOT 1
- DCN getObjectName display mess code HOT 1
- Invalid problem of batch std::vector<ocilib::Date > date display. HOT 4
- C++ Value types perform handle assignment instead of value assignment
- Two doubts ! HOT 1
- Reusing prepared statement hangs HOT 2
- OcilibElementSetRaw bug HOT 1
- Pool connection is never released (C++) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocilib.