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 
 
A little more help required

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
etched_in_blood



Joined: 28 Apr 2009
Posts: 13

PostPosted: Tue May 19, 2009 0:18    Post subject: A little more help required Reply with quote

I have everything all set up. I have NWNX installed, along with the ODBC, which is also set up correctly. Yet, my spawning system refuses to work. Thanks to the log function for ODBC I can actually show you what it's telling me.

Code:
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: 524288 bytes
o Log level: Everything will be logged.
o Using SQLite connection.
o Hooking SCO....hooked at 5d5830
o Hooking RCO....hooked at 5d5710
o Connect successful.
o Got request: SELECT resref FROM spawns WHERE terrain = 4 AND cr = 5 ORDER BY RANDOM() LIMIT 1
! SQL Error: no such table: spawns
o Sent response (0 bytes):


Now, if I go into the MYSQL command line, and type in the password, then give the use blackwater; command, then give the

describe spawns; command, it works just fine. And if I fire off a few test commands, it pulls them correctly and finds the table and its entries. So the command line seems to be finding the table just fine. And I also downloaded a GUI for MYSQL, and it also connects to the database just fine, and also sees and can access and edit the table spawns.

However, whenever I try to pull it from NWN, I get that message up there in the log. That the table doesn't exist. Then I go into the command client, and type in a few commands, and see that it obviously does exist, and that I can access it. It's great that it's working command line side, but if I can't access it from NWN, it's obviously not going to do me any good. Does anyone know what the problem might be???
Back to top
View user's profile Send private message
Maltalossėwen



Joined: 15 Jul 2007
Posts: 10

PostPosted: Tue May 19, 2009 1:17    Post subject: Reply with quote

I could be mistaken but your log file states

o Using SQLite connection.

which can't be right if you want to work with MySQL.

Have you made the correct settings in your nwnx.ini file?
The database settings should be something like this (this works on my server):

[ODBC2]
MaxLogsize = 512
LogLevel = 2
source = mysql
server = 127.0.0.1
user = [your username]
pwd = [your password]
db = [name of your database]
hookscorco = true
Back to top
View user's profile Send private message
etched_in_blood



Joined: 28 Apr 2009
Posts: 13

PostPosted: Tue May 19, 2009 9:34    Post subject: Reply with quote

Here's my setup

Code:
[ODBC2]
; Log file
MaxLogSize = 512 ; 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 = localhost
;user   = root
;pwd    = mypassword
;db     = blackwater

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



I just tried removing the section about sql lite, leaving my settings looking like this:

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

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

; Use these five settings for MySQL connections
;source = mysql
;server = localhost
;user   = root
;pwd    = mypassword
;db     = blackwater

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



Which results in this error from the log:


Code:
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: 524288 bytes
o Log level: Everything will be logged.
o Using ODBC connection.
o Hooking SCO....hooked at 5d5830
o Hooking RCO....hooked at 5d5710
! Error while connecting to database: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
o Got request: SELECT resref FROM spawns WHERE terrain = 4 AND cr = 4 ORDER BY RANDOM() LIMIT 1
! SQL Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
o Empty set


So then I finally figured out that I needed to remove the ODBC part, and it still didn't work, and then I realized that the MySql lines were commented out for no apparent reason. So I finally undid that. And FINALLY it's using the database succesfully... there's only one problem... now that it's using the right database, it would seem that my commands are somehow off. This is the error I'm getting:

Code:
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: 524288 bytes
o Log level: Everything will be logged.
o Using MySQL connection.
o Hooking SCO....hooked at 5d5830
o Hooking RCO....hooked at 5d5710
o Connect successful.
o Got request: SELECT resref FROM spawns WHERE terrain = 4 AND cr = 3 ORDER BY RANDOM() LIMIT 1
! SQL Error: FUNCTION blackwater.RANDOM does not exist
o Empty set



And here is the code that's firing that gives me that error message:

Code:
#include "random_location"
#include "aps_include"
string GetResrefByTerrainAndCR(int nTerrain, int nCR);

string GetResrefByTerrainAndCR(int nTerrain, int nCR)
{
string SQL = "SELECT resref FROM spawns WHERE terrain = " + IntToString(nTerrain)+ " AND cr = " + IntToString(nCR) + " ORDER BY RANDOM() LIMIT 1";
SQLExecDirect(SQL);
if (SQLFetch() != SQL_ERROR) return SQLGetData(1);
return "";
}


Obviously the problem is where I'm trying to randomly select one of the results of the query. But Funky posted this bit of script, I would think it would be right.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue May 19, 2009 10:03    Post subject: Reply with quote

Uncomment (';' is the comment symbol) the lines with MySQL connection settings.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
etched_in_blood



Joined: 28 Apr 2009
Posts: 13

PostPosted: Tue May 19, 2009 10:15    Post subject: Reply with quote

And holy crap, with a little help from google, I found the error, and repaired it! I'M GOOD TO GO!!!!!!!!

.................... and the successful execution crashes the server. Wow... great.
Back to top
View user's profile Send private message
Kosmous



Joined: 10 Jan 2005
Posts: 44

PostPosted: Wed May 20, 2009 10:03    Post subject: Reply with quote

would be helpful if you posted the logs again so people here can help you out.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules 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