-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New connection v2.0 #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting this. Can you please add a little more information:
No, I'll fix this problem if you provide me with more information. Thanks for reporting the typo, that's fixed now. |
registry.connect(function(err){
if(err) socket.emit('debug',err,'db registry error 1'); I have 2 connections, even if I don't connect manually. If you say me to update my node I'll and sorry if that isn't the track trace. |
{ config:
{ host: 'localhost',
port: 3306,
user: 'root',
password: 'password',
database: 'db',
debug: false,
typeCast: true,
maxPacketSize: 16777216,
charsetNumber: 192,
clientFlags: 194511 },
_socket:
{ _handle: null,
_pendingWriteReqs: 0,
_flags: 0,
_connectQueueSize: 0,
destroyed: true,
errorEmitted: false,
bytesRead: 87,
bytesWritten: 75,
allowHalfOpen: undefined,
_connecting: false,
writable: false,
_events: { error: [Object] },
_pipeCount: 0,
readable: false,
_connectQueue: null,
_idleNext: null,
_idlePrev: null,
_idleTimeout: -1 },
_protocol:
{ readable: true,
writable: true,
_parser:
{ _buffer: <Buffer 01 00 00 02 fe>,
_offset: 9,
_packetEnd: 5,
_packetHeader: [Object],
_packetParser: [Function],
_encoding: 'utf-8',
_paused: false },
_config:
{ host: 'localhost',
port: 3306,
user: 'root',
password: 'password',
database: 'db',
debug: false,
typeCast: true,
maxPacketSize: 16777216,
charsetNumber: 192,
clientFlags: 194511 },
_callback: null,
_fatalError: { [TypeError: Object #<Handshake> has no method 'EofPacket'] code: 'PROTOCOL_PARSER_EXCEPTION', fatal: true },
_quitSequence: null,
_destroyed: false,
_queue: [ [Object], [Object] ],
_events: { close: [Object], unhandledError: [Function] },
_pipeCount: 1 },
_connectCalled: true } this is what console.log give me of the object |
The stack trace is the file names and line numbers you see when throwing an exception. To see it, you must change: if(err) socket.emit('debug',err,'db registry error 1'); to if(err) throw err; Can you please do that and show me the output? Thanks a lot. |
One idea: Are you calling connect() multiple times on the same object? |
I'm calling just 1 time. io.sockets.on('connection', function (socket){
socket.on('init',function(data,fn){
registry.connect(function(err){
if(err) throw err;
}); node.js:201 |
@akd3vs Judging by your code it looks like connect() is called on the same instance every time someone connects via socket.io. You might try connecting on script startup and then just perform your queries when people connect via socket.io, etc. |
@felixge I still getting the error, what I do is clone the repository and checkout 95748f3, then make npm install and verify the file changes in node_modules. node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Handshake> has no method 'EofPacket'
at Protocol._parsePacket (/root/local/node/lib/node_modules/mysql/lib/protocol/Protocol.js:157:23)
at Parser._packetParser (native)
at Parser.write (/root/local/node/lib/node_modules/mysql/lib/protocol/Parser.js:42:10)
at Protocol.write (/root/local/node/lib/node_modules/mysql/lib/protocol/Protocol.js:31:18)
at Socket.ondata (stream.js:38:26)
at Socket.emit (events.js:67:17)
at Pipe.onread (net.js:367:14) Edit1: I created another script and i'm sure, is not a double connect. |
I think I know what the issue is. This is very likely a server that tries to use the old MySQL authentication mechanism. I dropped support for this in 2.0, but I think I'll bring it back. |
Thank you for try it again. :) I really like the Streaming query rows. A little doubt, i hope you can tell if it is in plans or you like the idea:
http://codeigniter.com/user_guide/database/active_record.html#select |
@akd3vs I won't add many ORM-like features, but you can do this in 2.0: var conditions = {name: 'my name', title: 'my title', status: 'my status'};
connection.query('SELECT * FROM users WHERE ?', conditions, function(err, rows) {
// ...
}); |
Thank you! Now I can connect and do querys and everything. Also I update the password of the user with PASSWORD(). Thank you again :) |
@akd3vs happy to hear that : ). |
I still cannot connect, get the same error :( |
@ibnmasud what version are you using? You'll have to get the latest version from git for this fix. |
Hi, I have the following code to attempt to connect to 'somehost.com' which is using the old_password algorithm. I've set the flag 'insecurePassword' to true, but I keep getting this error: 'TypeError: Object # has no method 'EofPacket''. Any idea? var GolAGOl = new (function()
})(); Here is the stack trace ERROR: TypeError: Object # has no method 'EofPacket' /Users/tin/Sites/golagol/www/js/node.js:29 |
@tin-r which node-mysql version are you using? |
Hi, i'm using node v0.6.19 and node-mysql v0.9 |
@tin-r That's impossible. node-mysql v0.9 had no You'll have to use the latest node-mysql from master for the feature you need, a new npm release is coming soon. |
@felixge I'm sorry, I think I was still asleep at the time I answered. The node-mysql version is v2.0.0-alpha2 (unreleased) |
@tin-r alright, then could you try upgrading to the latest version from github? |
Thanks a lot @felixge it's now working. If it helps anyone else, at first, I didn't know how worked node modules. I installed node-mysql with the node package manager, which, seems not to has the most recent update supporting old mysql passwords. I just downloaded the last version from github and extracted the files into a folder called "mysql". Please notice that, since you're not installing node-mysql from the npm (node package manager) when you're importing it into your project, you're gonna have to call the "index.js" file in the packet instead of calling "mysql", in my case it would be something like require('./mysql/index.js'). When I first ran my script after doing this changes, an exception were thrown indicating that the module "require-all" wasn't found. To fix this, I entered "npm install require-all", I ran my script again and voilá! Smooth! To use with mysql old passwords, make sure to set the flag 'insecureAuth' to true. |
@tin-r Or you could install as normally "npm install path/to/node-mysql" |
Yeah! Or that @akd3vs : ) |
Ok, closing this. Btw. the proper way to install the latest version from Github is:
I just added this to the Readme in a42a2eb . |
I'm trying to connect and nothings happend, trows this error
Object { code="PROTOCOL_PARSER_EXCEPTION", fatal=true }
and console.log() to the object I notice this: Object # has no method 'EofPacket'.
do i have to go back to 0.9.6?
By the way, you have an error here -> https://github.com/felixge/node-mysql/tree/v2.0#server-disconnects it has 3 n's in connection = mysql.createConnnection(connection.config);
The text was updated successfully, but these errors were encountered: