Questions tagged [node-mysql]

A pure node.js JavaScript Client implementing the MySql protocol. This is about the node package `mysql`, not `node-mysql` which is much less popular.

699 questions
0
votes
2 answers

fetching an entry from an INT column as a string?

In my MySQL table I have a column id which stores some very large integers. I have a query in my Node.js code which fetches records from this table. Recently I've noticed that some of the INTs fetched are wrong. For example, if the id in MySQL is…
sveti petar
  • 3,637
  • 13
  • 67
  • 144
0
votes
2 answers

Express and Node js - Can't redirect on error

So the thing is that I'm trying to catch a MySQL error, so when it happens I just want to redirect the user to another page of my app and display a notification or something, but doesn't matter what URL I put in the redirect method it sends me to…
erosespinola
  • 103
  • 8
0
votes
1 answer

Node Mysql Pool Not Ending / Closing

Am I missing something here? This should work fine, but I find that Node run loop stays active. var mysql = require('mysql'); //Setup Connections and Parser var pool = mysql.createPool({ host : 'localhost', user : 'me', …
4m1r
  • 12,234
  • 9
  • 46
  • 58
0
votes
0 answers

How to solve insert array element in to DB via nested query

i'm using node-mysql, var arr= ["usr1""usr2""usr3""usr4"]; for(var i=0;i
Lokesh G
  • 831
  • 11
  • 19
0
votes
0 answers

selects only return partial result

I have around 24k of rows in mysql database. Now using nodejs I would like to query and then store it in json file. var fs = require('fs'); var mysql = require('mysql'); var connection = mysql.createConnection({ host : '10.1.1.2', user :…
FRizal
  • 448
  • 7
  • 15
0
votes
1 answer

Concurrent Requests - Why's the database connection crashing the Node process

Overview I'm developing an MVC application with NodeJS. When the application loads for the first time, the database object (using a pool) is created. var pool = mysql.createPool({connectionLimit: 150, host: __host, user: __user,…
Kneel-Before-ZOD
  • 4,141
  • 1
  • 24
  • 26
0
votes
1 answer

Values of the results object is null when quering a database in node.js

So I'm trying to query a record from a database and then put it into xml format in node.js. The programname is the primary key of the sasinfo table, so it's guaranteed that I'll only be working with one record. The problem is that when I run the…
0
votes
1 answer

Node-mysql pool.query gets disconnected after 10 minute query

I'm using nodejs with node-mysql to connect to a mysql database. I'm using pool.query to call a stored procedure in the database. This particular one takes quite a while to run. I receive this error Error: Connection lost: The server closed the…
Paul Milham
  • 526
  • 5
  • 13
0
votes
1 answer

node-mysql doesn't reuse connections

I'm using the connection pool in this way: var pool = mysql.createPool({ host: config.db.host, port: config.db.port, user: config.db.user, password: config.db.password, database: config.db.database, connectionLimit:…
Saran
  • 3,845
  • 3
  • 37
  • 59
0
votes
1 answer

node-mysql Connection Pooling "No connections available" for Node.js Application

I've got a website I've written that gets data from a Restful web service. That Restful web service is run off node.js and MySQL using node-mysql. The problem I am running into is with connections running out. For example, my default page does a…
Adam Baruh
  • 11
  • 3
0
votes
0 answers

Node.js server takes a long time to establish connection to database

I've built a Node.js server that uses the node-mysql module to connect to a MySQL server. I use the following piece of code: var pool = mysql.createPool( { connectionLimit : 15, waitForConnections : true, host : 'remotehost', …
raul
  • 1,209
  • 7
  • 20
  • 36
0
votes
3 answers

Even when MySQL "where" clause is not met, it returns a row

edit: table structure, http://puu.sh/bQKRz/785c731604.png /* * Let's get a RANDOM question from the questions table * Ignore questions the group has already */ Group.prototype.getRandomQuestion = function(callback){ var self = this; var…
X33
  • 1,310
  • 16
  • 37
0
votes
1 answer

Send DBNull.Value instead of 'null' in nodeJS MySql

HOw can i send null value to database in node.js? I am using MySql Package for node JS and I have some null values to insert which I want to be stored in database as DBNull.Value( as in asp.net) and not as "null" or " ". Also, I cannot skip any…
writeToBhuwan
  • 3,233
  • 11
  • 39
  • 67
0
votes
1 answer

node-mysql can't seem to connect

I've been having issues with node-mysql where I haven't been able to get a connection with it. Here is my code: var mysql = require('mysql'); var pool = mysql.createPool({ connectionLimit: 10, user: 'node', password: 'pass', host:…
dkran
  • 284
  • 2
  • 4
  • 16
0
votes
1 answer

Properly handling duplicated key with node-mysql

I'm writing a registration form in my application, the user's name and the user's email must be unique. I run a mysql database and use node-mysql (v 2.0.0) as driver. When a user tries to use a name that is allready registered in the database,…