Mysqloo connectivity issue

So this was working a few minutes ago, I went to go eat and came back, hadn’t touched a thing but now my mysqloo database connection no longer works. It doesn’t give an error and it’s status is always on connecting. I’ve checked the remote access to my database… and there were no problems there. Any ideas?


function connectToDatabase()
	databaseObject = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
	databaseObject.onConnect = function() print ("Database connected") end
	databaseObject.onConnectionFailed = function() print ("Database Connection Failed!") end
	databaseObject:connect()
end

The function itself is running because I inserted print statements in there to verify some sort of call.

Make sure the dll is named gmsv_mysqloo_win32.dll inside your server_directory/garrysmod/lua/bin/

Make sure you require( “mysqloo” ); and do connection stuff inside hook.Add( “Initialize”, “Database”, function( ) … end );

Make sure it’s server-side only.

I think it’s mysqloo.initialize; but not sure. I use tmysql 99% of the time and use mysqloo as a fallback. I’ll double check but we need more information from you.

It’s all server sided, the gmsv_mysqloo_win32.dll is in the right place and require(“mysqloo”) is in use. I’ll try the hook give me a second for that. Thanks for the help by the way!

[editline]2nd February 2014[/editline]

hooks did nothing. The only thing as far as I can see that might have something to do with this is

Nav File is wrong or something (1)

but that might be for an addon

Nav file is something else; it’s how AI / NPCs walk around the map.

The hook I gave is so that the mysql connect is only called ONCE per map load. As long as you don’t have sql errors or code errors around the sql, you shouldn’t have to reconnect.

alright, I added that, but it’s still didn’t work. Like I said it was working fine earlier. I hopped on MySQL Workbench and I have only 3 connections to that database out of a max of 25

I also tried connecting to another database and still had the same issue. No errors, just constant “connecting” status

I did some research; apparently you need to add the OnFailed functions, and other functions before you call connect.

Additionally, you’re calling an empty connect line… Delete the empty connect line, and call the connect line with your mysql information last after you set up the functions.

Alright, I’ll give it a shot, thanks

[editline]2nd February 2014[/editline]

Just realized this the database object isn’t connecting on the first line that’s where it’s being defined. Like where all the connection infomation goes, if I move that line than I’m going to get errors for databaseObject being undeclared. and connect is just the function that runs the connect with the arguments given in the mysqloo.connect function. I think this has something to do with its remote host connections so I’m going to try it on a localhost

[editline]2nd February 2014[/editline]

Well I tested it on a localhost and… nada… so I don’t understand what’s going on, you mentioned another MySQL plugin, tmysql? Where will I go about finding that.

[editline]2nd February 2014[/editline]

Oh my god… You’ll never guess what the bug was… I had onConnect instead of onConnected…