how to check table is exist or not before executing any other query in connection pool
See original GitHub issueI have tried the following … but it failed…
'use strict';
const mysql = require('mysql');
const dbConfig = require('../../../config/index').DB;
const pool = mysql.createPool(dbConfig);
pool.query('SHOW TABLES LIKE users', (error, results) => {
if(error) return console.log(error);
console.log(results)
});
pool.on('connection', function (connection) {
console.log('%d conneted', connection.threadId)
});
pool.on('release', function (connection) {
console.log('Connection %d released', connection.threadId);
});
module.exports = pool;
SHOW TABLES LIKE "users";
this query works fine in command line mysql client but failed in node context…
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Efficient SQL test query or validation query that will work ...
This is the query that will be executed just before a connection is given to you from the pool to validate that the...
Read more >SQL Server Connection Pooling - ADO.NET - Microsoft Learn
When a new connection is opened, if the connection string is not an exact match to an existing pool, a new pool is...
Read more >17 Tuning Data Source Connection Pools - Oracle Help Center
This chapter provides information on how to properly tune the connection pool attributes in JDBC data sources in your WebLogic Server 12.1.3 domain...
Read more >Improve database performance with connection pooling
When a new request to access data from the backend service comes in, the pool manager checks if the pool contains any unused...
Read more >STATS (statistics) - ProxySQL
Generally, the tables from this database are populated on the fly when the SQL query against them is executed, by examining in-memory data ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem! Without quotes doesn’t even work in the command line for me:
Hi @shivarajnaidu I’m not 100% sure what you’re asking for, because the title and the text and the code all seem to be doing different things, so I’m not sure which is the question. Would you mind rewording it?