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 
 
Problems with MySQL syntax

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
DocBane



Joined: 12 Apr 2010
Posts: 3

PostPosted: Mon Apr 12, 2010 18:37    Post subject: Problems with MySQL syntax Reply with quote

Hello

I am completely new to nwnx and almost new to MySQL. I'm not too familiar with the syntax and I seem to be getting the following error in the nwnx_odbc logfile.

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: DROP TABLE pwdata
! SQL Error: no such table: pwdata
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: near "ENGINE": syntax error
o Got request: SELECT player FROM pwdata WHERE player='DocBane' AND tag='Vizo' AND name='demoName'
! SQL Error: no such table: pwdata
o Sent response (0 bytes):
o Got request: INSERT INTO pwdata (player,tag,name,val,expire) VALUES('DocBane','Vizo','demoName','testValue',0)
! SQL Error: no such table: pwdata
o Got request: SELECT val FROM pwdata WHERE player='DocBane' AND tag='Vizo' AND name='demoName'
! SQL Error: no such table: pwdata
o Sent response (0 bytes):


The script in the aps_demo mod:
Code:

#include "aps_include"

void main()
{
    SQLExecDirect("DROP TABLE pwdata");
    SendMessageToPC(GetLastUsedBy(), "Table 'pwdata' deleted.");

    // For MySQL
    SendMessageToPC(GetLastUsedBy(), "Creating Table 'pwdata' for MySQL...");
    SQLExecDirect("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;");


    SendMessageToPC(GetLastUsedBy(), "Table 'pwdata' created.");
}


It seems to be using SQLite connection even though it's supposed to use MySQL connection?

I tested it with the SQLite script part and it seems to work fine. I'd still like to know why it doesnt work with MySQL though.

More information:
I've two PC's, one being the dedicated server and the other I use to test the mod on the server. Now I've no problem connecting from my client PC to the server's MySql database and editing it, I can create tables and edit tables from the MySQL workbench and they are saved on the server no problem. I just don't get it what the problem is with nwnx.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Apr 12, 2010 21:09    Post subject: Reply with quote

hi

you need to adjust nwnx.ini file

Code:
[ODBC2]
; Log file
MaxLogSize = 5512 ; 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    = ####
db     = ####

look at my settings and compare with your, I think you will get the error this way
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
DocBane



Joined: 12 Apr 2010
Posts: 3

PostPosted: Tue Apr 13, 2010 8:29    Post subject: Reply with quote

This is my nwnx.ini

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 = 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    = ****
;db     = nwn

; 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


Also I tried to give a look at the sqlite.db file with SqLiteCC, seems to crash whenever I try to open it.

Odd thing is it doesn't seem to be able to find/access the database at all. I manually added pwdata table to the mysql nwn database. The DROP table command doesnt find it and gives the error.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Apr 13, 2010 13:09    Post subject: Reply with quote

yes exactly as i thought, look if you using MySQL datbaase you must remove ";" from MySQL settings

like this
Code:
; Use these five settings for MySQL connections
;source = mysql
;server = localhost
;user   = root
;pwd    = ****
;db     = nwn


and add ";" to SQL settings

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

_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
DocBane



Joined: 12 Apr 2010
Posts: 3

PostPosted: Tue Apr 13, 2010 15:46    Post subject: Reply with quote

Ahh such a small detail I did not notice at all! Thank you very much ShaDoOoW Smile . It works as expected now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support 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