[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Smaug and MySQL

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Smaug and MySQL
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Sat 25 Mar 2006 07:56 AM (UTC)  quote  ]
Message
actually no, it was not working at any time until i switched it to a global definition. its strange i know, but since i switched it i have had no problems at all.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Tue 07 Mar 2006 04:56 AM (UTC)  quote  ]
Message
Maybe you weren't closing it correctly, so it worked the first time you updated the database but any subsequent call failed because the first one was still around. That's usually a danger with opening it every time.

(besides, you don't really need to, and in fact it's arguably much more efficient to open it only once, as Whiteknight suggested)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Tue 07 Mar 2006 04:04 AM (UTC)  quote  ]
Message
WhiteKnight had it right from the start, i switched over to global definitions and an open_db_connect() at startup and now it works just fine, i can connect and query the database. wierd huh, don't know why that would be any different but learn something every day.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Sat 04 Mar 2006 11:30 AM (UTC)  quote  ]
Message
OK. Have you checked all the connection options? Namely, init-command.
The documentation is here:
http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html

There should be a link somewhere there, or not far away, that shows how to get the current options.

Obviously PHP is connecting slightly differently from the C library...

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Sat 04 Mar 2006 09:06 AM (UTC)  quote  ]
Message
Error: 2013 (CR_SERVER_LOST)

Thats what I'm getting.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Fri 03 Mar 2006 08:25 PM (UTC)  quote  ]
Message
No, you can't put the port into the IP address when making the connection call.

Are you *sure* that the connection is failing? Looking through the error messages for mysql_real_connect:
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
doesn't list that error. It does however list a number of interesting things, such as mismatching protocol versions. Are you sure you have matching/compatible protocol/library versions?

If you could get the error name as opposed to error text (e.g. get CR_CONNECTION_ERROR) that would help pinpoint the problem.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Fri 03 Mar 2006 06:10 PM (UTC)  quote  ]
Message
Changing the port from 1210 to 0 gave me this: [IMM_GEN] Stats_Player_Killed_Monster: Error: Can't connect to MySQL server on '127.0.0.1' (111)

Another thing I tried was changing MYSQL_SERVER to "127.0.0.1:1210" and that didn't work either, got this: [IMM_GEN] Stats_Player_Killed_Monster: Error: Unknown MySQL Server Host '127.0.0.1:1210' (3)
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] bio
Date Fri 03 Mar 2006 03:17 PM (UTC)  quote  ]
Message
Try changing the port number in your mysql_real_connect call to 0.

It would then look like:


mysql_real_connect(hnd,MYSQL_SERVER,MYSQL_USER,MYSQL_PWD,MYSQL_DB,0,NULL,0)

~Nick Cash
http://www.nick-cash.com
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Fri 03 Mar 2006 04:47 AM (UTC)  quote  ]

Amended on Fri 03 Mar 2006 04:49 AM (UTC) by Gohan_TheDragonball

Message
Quote:

The usual questions:
- are you sure that the DB is up and running?
- are you sure that you have the right user/pass?
- are you sure that the DB has privileges set up correctly to allow your user/pass from local connections?
- is there some strange firewall configuration that would somehow be blocking local connections on that port?
- can you connect to the DB otherwise e.g. from perl or php?


i am sorry i guess i should have mentioned those things as well, i tend to assume too much. my website which is also local running php can connect and query the database just fine. the password/user is correct as well. the mud is located in the same shell as the website, so that is not an issue as well. the only thing i can assume is because i am trying to connect to it from a MUD.

One of my theories is that the database is trying to write back to the mud, the mud is not correctly handling it, and it is failing. Should that be the case I would not in a million years know how to fix it.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Thu 02 Mar 2006 09:32 PM (UTC)  quote  ]
Message
OK... it's important to know that it wasn't the queries.

The usual questions:
- are you sure that the DB is up and running?
- are you sure that you have the right user/pass?
- are you sure that the DB has privileges set up correctly to allow your user/pass from local connections?
- is there some strange firewall configuration that would somehow be blocking local connections on that port?
- can you connect to the DB otherwise e.g. from perl or php?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Thu 02 Mar 2006 08:06 PM (UTC)  quote  ]
Message
I should also mention its failing at the mysql_real_connect() part, so the queries are not whats failing.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Thu 02 Mar 2006 07:54 PM (UTC)  quote  ]
Message
"I am using double quotes with 'single' quotes inside"
I'm not sure what the problem with double quotes is. If you could post your code again, with double-quotes so I can see exactly what's going on, that would be helpful.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Thu 02 Mar 2006 07:47 PM (UTC)  quote  ]
Message
The forum changed it to single quotes.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Thu 02 Mar 2006 06:47 PM (UTC)  quote  ]
Message
Did you check my post? Your posted code just isn't right, so I suspect you didn't post exactly what your code is.

In fact, all of your strings use single quotes and not double quotes, so I'm not sure quite what you're doing.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Gohan_TheDragonball   USA  (183 posts)  [Biography] bio
Date Thu 02 Mar 2006 06:34 PM (UTC)  quote  ]
Message
Well, if I can't connect even once, how will changing it to a global connection and ran at startup change it. While I do agree, I would prefer to only connect once and point to that connection rather than multiple connection and disconnects, I first need to figure out why it won't connect.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


5,350 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]