Questions tagged [node-mysql2]

131 questions
0
votes
2 answers

node-oracledb multiple statement in one query

In MySQL we can do the multiple statement in one query like below example. Is there any similar way to run multiple statement in one query in oracledb? const mysql = require('mysql'); const connection = mysql.createConnection({ host:…
faisal-akbar
  • 33
  • 1
  • 7
0
votes
1 answer

How to use mysql2 library with Sapper?

I am creating an application in Svelte Sapper. I have a routes/account/login.js API route where I am trying to use mysql2. The route itself works (I checked with Postman), but as soon as I import mysql, the server crashes and an error…
Rafaucau
  • 323
  • 2
  • 20
0
votes
1 answer

Node/Express error: TypeError: Cannot read property 'then' of undefined

I submit a form to my express server and I get the following error: TypeError: Cannot read property 'then' of undefined The 'then' refers to the then in the (truncated) code below (a post method in a controller file). exports.postAddVehicle = (req,…
DeltaFlyer
  • 461
  • 2
  • 8
  • 17
0
votes
1 answer

node-mysql2: Object.entries is not a function

I am trying to set up nodejs project on Hostgator. But while setting up I am getting the below error. Any help would be really appreciated. My node version is 16.8.0 and the npm version is 7.21.0 …
Manik Thakur
  • 294
  • 2
  • 15
0
votes
0 answers

How to get the mysql command from mysql2/promise in node js

For the code below how can I get the full query Like INSERT INTO TABLE(.........) VALUES(........); I can create the function to create command but it would look bad So Is there way of getting the query used here I have used mysql2/promise let…
prosach
  • 312
  • 2
  • 14
0
votes
1 answer

Node-MySQL2 library can connect to MySQL 8 but not with MySQL 5.7

On my dev environment, I have installed MySQL 8.0 and built the app accordingly, But on the prod server, the MySQL version is 5.7 and my app fails to connect to the database. I use the mysql2 package because I need the Async API (mysql2/promise)…
Nalin Angrish
  • 317
  • 5
  • 17
0
votes
1 answer

Node.js mysql2 connection pool execution issue

I'm still new to nodejs and cannot understand something. I have db.js file with code: function connection() { try { const mysql = require('mysql2'); const pool = mysql.createPool({ host: 'localhost', user: 'user', …
yieChug1
  • 85
  • 7
0
votes
1 answer

node-mysql2 query stream returns incorrect number of results

I'm querying the database periodically to extract a potentially large dataset. To do so I'm using mysql2 query streams, so I would be able to consume it via async iterator. async* getData(startTime: Date, endTime: Date) : AsyncGenerator { …
Boris
  • 443
  • 8
  • 15
0
votes
1 answer

How to update a MySQL record with a NULL value using AG-Grid valueSetter?

this isnt doing the trick. no error is produced on the console, but refreshing the page just brings back the previous value. replacing null with any other data befitting the column works as intended. valueSetter: params => { params.data.column =…
0
votes
1 answer

"Allocation failed - process out of memory" when index.js has "require('mysql2');"

Purpose I want to use mysql2 (npm). Steps Install MySQL by brew install mysql, set up to make sure I can login by mysql -r root -p Run npm init and npm install mysql2 --save Create index.js (see below) Run node index.js See an error below. Steps…
dmjy
  • 1,183
  • 3
  • 10
  • 26
0
votes
0 answers

Wait for async function before continuing on NodeJS

I'm currently using NodeJS v10.24.0, and having some trouble setting up a MySQL lookup to be asyncronous with ExpressJS. Main: app.get('/player/:username', async function (req, res) { var uuid = await…
Permanently
  • 344
  • 2
  • 3
  • 13
0
votes
1 answer

Cannot use bindNodeCallback with node-mysql connection.query

I'm trying to use bindNodeCallback to convert connection.query into a function that returns observable. const mysql = require('mysql2'); const { bindNodeCallback } = require("rxjs"); const connection = mysql.createConnection({host:"servername",…
Marinos An
  • 9,481
  • 6
  • 63
  • 96
0
votes
1 answer

How to return mysql data to caller? Something works, other case don't work?

It is my db object code(DBO.js): class DBO { constructor(){ let dbConfig = require('./config'); dbConfig["multipleStatements"]=true; const moment = require('moment'); const mysql = require('mysql2'); const…
The KNVB
  • 3,588
  • 3
  • 29
  • 54
0
votes
1 answer

How do I determine the column type name from the columnType integer value in mysql2?

When querying with mysql2, the third argument to the callback function fields has the following documentation: console.log(fields); // fields contains extra meta data about results, if available Ok, great. But when I look at the values in the…
lucasvw
  • 1,345
  • 17
  • 36
0
votes
0 answers

How should a class close a connection pool?

I'm building a very rudimentary ORM while I learn Node. I have the constructor currently accept either a name or id parameter but not both. If the name is provided, the class creates the record in the database. If the id is provided, it looks up the…
Chuck
  • 4,662
  • 2
  • 33
  • 55
1 2 3
8 9