B4J Question Connection pool, I am on the right ways? - EnriqueGonzalez (first post)    
Dec 02, 2022   
(3 reactions)hi!
no!
for connection pool:
1. dim it in Global variables in main
2. initialize on appstart
3. everytime you want to use the pool call getConnection
3. close everytime the created connection
Sub Handle(req As ServletRequest, resp As ServletResponse)
dim sql as sql = main.pool.getconnection
try
link: @EnriqueGonzalez Thank you
you help me a lot
link: I am not very familar whit connection pool. I just want to know if my understand is good. So, I copy a class module server handler.
'Handler class
Sub
B4J Question concurrent execution with JSERVER and SQLITE - Erel (first post)    
Mar 02, 2022   
(1 reaction)Connection pool is a good way to manage multiple connections. In the case of SQLite you need to be careful as its threading model is more fragile compared to most other SQL engines.
link: @Erel @Quandalle
Tested & confirmed - using a connection pool solves the problem.
Using HIkariCP from here; https://www.b4x.-high-performance-connec
link: @Quandalle thanks. Yes I have replicated the issue using your code.
Just some other comments;
1. In one of my projects I keep my full text search in
link: Thanks Erel for your investigation. This limitation of the jdbc driver is a negative point for web solutions with SQLITE, because we do not necessari
B4J Tutorial [Server] Building web servers with B4J - Erel    
Sep 01, 2021   
(31 reactions)Single threaded handlers can be useful in many cases. Some examples:
- A handler that accesses a SQLite database, which is less suitable for concurrent connections. See this tutorial for concurrent access to SQLite: https://www.b4x.-concurrent-access-to-sqlite-databases.39904/#content
- A handler th
B4J Question Open/Close Connection? - EnriqueGonzalez (first post)    
Oct 15, 2021   
(2 reactions)Yes, you may as well not use the connection pool at all, in this scenario you don'tneed it
link: Yes! do, or even better, as it is a MySQL database, just use a pool like the official connectionPool library or hickari. if you leave it open and expe
link: Follow the jRDC2 code. Use Connected/disconnected to get/close a SQL connection. Pooling will keep connections alive and re-use them
That's one of th
link: Yes that is what it should do.
But dont set it too low because u will loose the purpose of pooling. The whole idea is to reuse the connection and dont
B4J Question Connection Pool Management - Jmu5667 (first post)    
Jan 16, 2020   
(2 reactions)When using the connection pool you should always close a connection when you have finished the work.
link: Option A
Open connection once and never close it and used it again when necessary.
Sub Process_Globals
Private Pool1 As ConnectionPool
Private
link: Why are you getting multiple connections from the pool? Looks wrong.
The pool manages the connections. It takes care of providing you a working conn
link: So option B is better. Why?
Forgot to mention that the application runs only for one user.
Share My Creation [Project Template] Web API Server - aeric (first post)    
Oct 18, 2021   
(8 reactions)19/10/2021 - v1.11
- Better use of Connection Pool for MySQL (pool is not close)
- Change DataUtils module to DataConnector class
- Clean up some redundant codes
link: Slightly off topic but I recently did some tests with HikariCP and I got worse performance compared to having a single DB connection (defined in Main)
link: Can I summarize that it is sufficient to use the normal connection pool as Erel’s example?
link: I would say yes, if you are using a TCP based database connection (eg MySQL, Postgres etc) then it makes sense to use a pool.
If you are using a file
B4J Question jserver and connection pool - Erel (first post)    
Jan 29, 2019   
(1 reaction)The mistakes are:
- The whole idea of a connection pool is that it is created once and all handlers use it. It should never be created inside a handler class.
- Calling pool.GetConnection returns a "new" connection from the pool. Your code leaves the first connection open and then gets another conn
link: (not really closes it but rather returns the connection to the pool)
Correct way to work with a connection pool:
Dim connection As SQL = Main.Pool.G
link: Hello,
I am playing around with the jserver example. I can successfully reach the server on 127.0.0.1 , I set up a connection pool to mysql server wi
link: I don't understand your code. Where have you put it?
Why are you executing a SELECT query with ExecNonQuery?
You are not closing the connection. Thi
B4J Question JBDC pool connections: how to use correctly ? - amykonio (first post)    
Oct 12, 2023   
(1 reaction)Hi.
From what I know, connection pooling "offers" one advantage: a used connection is returned to the pool when closed. It's then available to be reused whenever someone needs to connect to the database.
Normal connections, when closed, they are not reused by someone else. They are finally destroyed
link: Connection pools are used to enhance the performance of executing commands on a database. Opening and maintaining a database connection for each user,
link: No. The B4J SQL library does not support JDBC driver-based pooling. Disable all driver-based pooling and use a 3rd party (such as ConnectionPool) obje
link: A connection pool doesn't have unlimited connections... So: yes you have to close the connection when you finished your task. How many times the timer
B4J Question java.lang.RuntimeException: java.sql.SQLException - Erel (first post)    
Mar 29, 2022   
(1 reaction)You are doing something wrong. I have B4J servers, with connection pools, running for months without any leak.
The correct way to work with connection pools:
Dim sql As SQL = pool.GetConnection
Try
...
Catch
End Try
sql.Close
link: Thanks Erel. the downside is that the pool connections keeps increasing with every failure. I have moved to Hikari CP and monitoring the pool utilizat
link: 100
Pool Data : pool connections = 39 out of a max. 100
Pool Data : pool connections = 39 out of a max. 100
03/24/2022 10:30:52 SQLExecuteMaps 2:
B4J Library HikariCP 5.x - Erel (first post)    
Mar 06, 2022   
(1 reaction)The correct comparison is jRDC2 with the default connection pool (c3p0) vs jRDC2 with Hikari.
link: This is a wrapper for HikariCP which is a database connection pool manager (https://github.com/brettwooldridge/HikariCP)
From the github page; Fast,
link: They are for different purposes.
JRDC2 provides a REST interface for access your database.
A database pool connection manager is about managing mult
Page: 1  
2  
3  
4  
5  
6  
7  
Powered by ColBERT