Hi,
I got an error from the MySQL Server (on 1&1) that "user .... already has more than max_user_connections active connections".
I make use of AppGini's SQL functions sql and sqlValue, so I am wondering, if they close their connection after the result has been received.
Or - does AG create a single connection an reuses it?
I am happy about any other ideas how to solve such a problem.
Olaf
Do sqlValue and sql functions close/reuse connections?
Do sqlValue and sql functions close/reuse connections?
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: Do sqlValue and sql functions close/reuse connections?
onoehring wrote: ↑2020-05-19 09:24Hi,
I got an error from the MySQL Server (on 1&1) that "user .... already has more than max_user_connections active connections".
I make use of AppGini's SQL functions sql and sqlValue, so I am wondering, if they close their connection after the result has been received.
Or - does AG create a single connection an reuses it?
I am happy about any other ideas how to solve such a problem.
Olaf
personally i rely on msqli
ajax-template.php
Code: Select all
<?php
$currDir = dirname(__FILE__) . '/..'; // inside hooks folder, remove the concatenation if placed in main app folder.
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
$con = mysqli_connect($dbServer, $dbUsername, $dbPassword);
mysqli_select_db($con,$dbDatabase);
$mi = getMemberInfo();
$ajax_var = makesafe($_REQUEST['ajax_var']);
$query = mysqli_query($con,"select * from policies where ID= '{$ajax_var}'");
$table_ajax = mysqli_fetch_array($query);
echo json_encode($table_ajax);
?>
Re: Do sqlValue and sql functions close/reuse connections?
Hi,
thank you, I will try your suggestion.
Olaf
thank you, I will try your suggestion.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Do sqlValue and sql functions close/reuse connections?
Hi,
just wondering if anyone has already used the db_close function which can be found in the /db.php file.
I am wondering if it's worth, putting the db_close in the end of my own file(s) - or maybe even into the /hooks/footer-extras.php ??
This should probably close the db connection. Of course, it would cost some time to reopen it again when a page is refreshed / loaded but at least this would not block other users from using the application because they have to wait for a db connection to automatically close.
Olaf
just wondering if anyone has already used the db_close function which can be found in the /db.php file.
Code: Select all
function db_close($link = NULL) {
db_link(false); /* close db link */
switch(DATABASE) {
case 'mysql':
return mysql_close($link);
case 'mysqli':
return mysqli_close($link);
}
}
This should probably close the db connection. Of course, it would cost some time to reopen it again when a page is refreshed / loaded but at least this would not block other users from using the application because they have to wait for a db connection to automatically close.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view