logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Connecting NWNX to an external MySQL DB

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Fri Aug 25, 2006 23:28    Post subject: Connecting NWNX to an external MySQL DB Reply with quote

I've been having troubles trying to connect NWNX to an external MySQL database, specifically the one that I run my forums on (phpbb). I've set up the NWNX/ODBC config file as follows, yet no tables are being created:

Code:
; NWNX2 configuration file
; These are the default values for NWNX2. Values specified on the command
; line take precedence.

[NWNX]
ServerPort = 5121
ModuleName = "aps_demo"
WatchdogProcess = yes
UpdateIntervalProcess = 5
WatchdogGamespy = no
UpdateIntervalGamespy = 20
GamespyRetries = 5
OldGamespyProtocol = no
RestartDelay = 5

[ODBC2]
; Log file
MaxLogSize = 10512 ; in KByte
LogLevel = 2 ; 0=nothing, 1=only errors, 2=everything

; Use these two settings for the SQLite internal database
;source = sqlite
;file   = sqlite.db

; Use these two settings for ODBC connections
;source = odbc
;dsn    = nwn

; Use these five settings for MySQL connections
source = mysql
server = hulk.osd.wednet.edu
user   = myusername
pwd    = mypassword
db     = mydbname

; Set hookscorco to false if you want to disable hooking of
; StoreCampaignObject and RetrieveCampaignObject entirely
hookscorco = true

[PROFILER]
MaxLogSize = 512 ; in KByte
LogLevel = 1 ; 1=overall statistics, 2=full script callstack


Perhaps I'm missing something obvious? I'm unsure (im not very good with MySQL at this point to say the least), but so far no results have come from using the aps_demo module.

On an unrelated note, whenever I click the second sign for test-storing an object in the table -- "store object to table" I think its named --, it crashes the nwserver.exe, which is odd. However, the string storage testing signs don't crash anything, and don't produce a result.

Any help is much appreciated, and thank you for your patience with yet another person who doesn't know entirely what he's doing Smile
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sat Aug 26, 2006 1:15    Post subject: Reply with quote

I see your DNS entry works Wink

PS-Wednet frowns on Gameservers and such things as I found out the hard way.....

Couple of things to check...
1) Make sure your firewall is not blocking 3306. Even if the NWServer is on the same machine as MySQL a block on that can stop the connection. If you ARE on the same machine, use localhost or 127.0.0.1 instead as it will bypass that issue.
2) You have verified with another utility that the username and password has remote access to the database? See point #1; calling the DB via hostname causes it to be viewed as an external connection, not internal.
3) If you are using MySQL 5 then you might need to adjust how the system views your login/authentication. I had to set mine to use 4.xx legacy connection-type. You can set this with MySQL Administrator which can be downloaded from MySQL's site. If someone else has better information on this please post it for me too Smile I have taken to normally running 4.0.18 when I don't know if apps are compatible with the new authentication scheme...

Hopefully that will get you started!
Back to top
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Sat Aug 26, 2006 4:16    Post subject: Reply with quote

Well I can use putty to remotely access the db, and the server is using mysql 4.0.20, so it should be fine as far as #s 2 and 3 are concerned. I'll check out #1 though, thanks for the tip. As for wednet, well, I'm hoping to move off it soon, but I'm not running a gameserver off it -- just some forums as a web development project of sorts Smile

I'll try forwarding 3306 and see what I can get.

*edit*

didnt work, but then again, I should have been smart enough to figure I'd have to go in and switch the scripts to MySQL rather than SQLite Wink -- I'll be doing that now and we'll see how it works.

*edit*

Unfortunatly, still no go, even after opening up the port and making sure the demo scripts were pointing to MySQL.
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sat Aug 26, 2006 17:36    Post subject: Reply with quote

Post up the content of your NWN/X logs.

They should give us more info....
Back to top
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Sun Aug 27, 2006 2:32    Post subject: Reply with quote

Logs:

nwnx.txt wrote:

NWN Extender V.2.6.1
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

* Loading plugins...
* Library ODBC!SPACER does not exist.* An error occured during OnCreate of odbc
* Plugin resetplugin is loaded.
* NWNX2 activated.


nwnx_odbc wrote:

NWNX ODBC2 plugin V.0.9.2.4
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

o Logfile maximum size limit is: 10764288 bytes
o Log level: Everything will be logged.
o Using MySQL connection.
o Hooking SCO....hooked at 5d0000
o Hooking RCO....hooked at 5cfee0
! Error while connecting to database: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Got request: DROP TABLE pwdata
! SQL Error: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Got request: CREATE TABLE pwdata (player varchar(64) NOT NULL default '~',tag varchar(64) NOT NULL default '~',name varchar(64) NOT NULL default '~',val text,expire int(11) default NULL,last timestamp NOT NULL default CURRENT_TIMESTAMP,PRIMARY KEY (player,tag,name)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
! SQL Error: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Got request: SELECT player FROM pwdata WHERE player='Jesterb769' AND tag='Generic Test Character' AND name='demoName'
! SQL Error: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Empty set
o Got request: INSERT INTO pwdata (player,tag,name,val,expire) VALUES('Jesterb769','Generic Test Character','demoName','testValue',0)
! SQL Error: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Got request: SELECT val FROM pwdata WHERE player='Jesterb769' AND tag='Generic Test Character' AND name='demoName'
! SQL Error: Can't connect to MySQL server on 'hulk.osd.wednet.edu' (10060)
o Empty set


nwserverlog1 wrote:

[Sat Aug 26 17:23:55] Loading Module: aps_demo
[Sat Aug 26 17:23:55]---- Server Options ----
Max Players: 6
Char Levels: (1-40)
Player Password: YES
DM Login Enabled: YES
Server Admin Login Enabled: YES
Post Game To Internet: NO
Game Type: Team
Difficulty: 1
PVP Setting: PARTY
Vault: LOCAL
Only One Party: YES
Enforce Legal Characters: NO
Item Level Restrictions: NO
Player pausing: DISABLED
Auto Save: Enabled
Saving Characters in Saved Game
---- End Server Options ----
Connection Attempt made by Jesterb769 (*******)
[Sat Aug 26 17:24:21] Jesterb769 (*******) Joined as Player 1


Theres my logs -- the others, nwnx_resetplugin and nwservererror1, were empty.

Seems its not connecting to the db server... not sure how to fix that though.
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sun Aug 27, 2006 7:48    Post subject: Reply with quote

It sounds like you are missing files....

Make sure you have the following in your NWN directory:
nwnx-module.dll
nwnx_odbc.dll
madCHook.dll
sqlite3.dll (not needed for MySQL but should be there)

Note the nwnx_odbc.dll is needed even if you are not using the ODBC connection.

Another thing for you to look at would be to download the PrC Server Pack 1.5 from the Vault. It has all the needed parts of NWNX plus NWNX_Leto for more features. Its version of SQLite is also a little higher, with some additional features.
Back to top
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Sun Aug 27, 2006 10:01    Post subject: Reply with quote

Odd, I just checked, but I've got all the dll's in my NWN directory except sqlite3.dll, but I couldnt find that in the NWNx package -- should that be downloaded from elsewhere?
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
odenien



Joined: 26 Sep 2005
Posts: 37

PostPosted: Sun Aug 27, 2006 13:30    Post subject: Reply with quote

If your database is sqlLite, then you would need it; not for mySQL.

can you connect with the mysql tools?

if so, does your nwnx.ini match your connection info used?
Back to top
View user's profile Send private message MSN Messenger
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Sun Aug 27, 2006 21:28    Post subject: Reply with quote

Ah... perhaps the problem is that I've been connecting to the server via ssh, then using MySQL from there. Trying MySQL Admin, that address doesnt work... hmm. I wonder if its even possibly to remotely access the MySQL db. If it is, any tips on where it might be hiding (a common location like <domain>/mysql, or something like that?)
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Sun Aug 27, 2006 22:05    Post subject: Reply with quote

Jesterb769 wrote:
Ah... perhaps the problem is that I've been connecting to the server via ssh, then using MySQL from there. Trying MySQL Admin, that address doesnt work... hmm. I wonder if its even possibly to remotely access the MySQL db. If it is, any tips on where it might be hiding (a common location like <domain>/mysql, or something like that?)
You'll have to define separate access rights for that user@domain.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sun Aug 27, 2006 23:13    Post subject: Reply with quote

Yep, your user doesn't have access Smile

Normally if you look at your users table you will see two entries for a user. Assuming very lax security you would see something like:

username@localhost <---for local access
username@% <---% is a wildcard for everywhere BUT localhost

Use your command line utilities (or if you have PHP on the machine's webserver load up phpmyadmin) and make a user with remote rights.
Back to top
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Mon Aug 28, 2006 21:38    Post subject: Reply with quote

well hmm... since I probably dont have access rights to make a new user, looks like I'll just have to find another alternative around this problem...
_________________
Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin
Back to top
View user's profile Send private message
odenien



Joined: 26 Sep 2005
Posts: 37

PostPosted: Tue Aug 29, 2006 14:21    Post subject: Reply with quote

If you can connect locally through ssh and do a SHOW GRANTS; not sure if you have to connect as root or just the user you want to extend.

Although, my system only says 'user'@'localhost' and I can connect outside of my linux space, but not using my external IP as the -host.

Also, make sure the remote server's firewall has to proper port available for pass-thru.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group