Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to properly handle connection persistent things within node-mysql connection pooling
    primarykey
    data
    text
    <p>If I use node-mysql's connection pooling feature, wouldn't this pose a problem in my app because connections are re-used after <code>connection.end()</code>? Here's why I'm concerned: When you define a variable in SQL, or start a transaction, the variable or transaction is persistent until the connection is closed. Since the connection is never actually closed, but instead re-used, the variables and transactions can seep into another routine that doesn't expect the variable or expect the transaction to exist; it expects a fresh connection.</p> <p>Variables could pose a big problem; a routine could never safely assume a variable to be undefined because the connection with wear and tear.</p> <p>Transactions could pose an even bigger issue if one routine were to ever fail to rollback or commit a transaction before calling <code>end()</code>. If the next routine that were to use this connection doesn't deal with transactions, then all queries would be appended to the transaction and halted, never to be executed. I could just be careful when writing my app that such an error never occurs, but mistakes happen, and if it does happen, it'd be extremely difficult to debug (I wouldn't know which routine is mishandling connections, bad bad).</p> <p>So these are some of my concerns when thinking about using pooling. Surely I'm not the only person to have thought of these issues, so please shed some light on how to properly handle pooled connections, if you'd be so kind. :)</p> <p>Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload