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 
 
NWNX2 database doesn't update

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



Joined: 05 Jan 2010
Posts: 2

PostPosted: Tue Jan 05, 2010 15:03    Post subject: NWNX2 database doesn't update Reply with quote

Hello

I was trying today the NWNX plugin for the firsttime. I installed both Main program and Database connectivity. To test, I first started NWNX2.exe and next I started the game and I choose to play the aps_demo. I clicked on some things to be sure something is created in the database: sqlite.db . When i close the game and i check the database file (sqlite.db), then i see this file exists, but it contains nothing (0kb).

It seems the game does not communicate with the NW Server to edit the database.
What could I be doing wrong ? I use Vista. Everything runs in XP-compatiblity modus.

Thanks in advance

This is nwclientlog:

[Tue Jan 05 13:34:40]Server Starting Up: 10 Second Heartbeat logging has been disabled
[Tue Jan 05 13:34:40]---- Server Options ----
Max Players: 6
Char Levels: (1-40)
Player Password: NO
DM Login Enabled: YES
Server Admin Login Enabled: YES
Post Game To Internet: YES
Game Type: Action
Difficulty: 2
PVP Setting: NONE
Vault: LOCAL
Only One Party: YES
Enforce Legal Characters: NO
Item Level Restrictions: NO
Player pausing: ENABLED
Auto Save: Enabled
Saving Characters in Saved Game
---- End Server Options ----
[Tue Jan 05 13:34:40] Player [] () Joined as Server Admin 1
[Tue Jan 05 13:34:40] Player () Joined as Player 1
[Tue Jan 05 13:34:40] Loading Module: aps_demo
[Tue Jan 05 13:35:02] Server Shutting Down
[Tue Jan 05 13:35:02] Player Left as a Server Admin (0 SA's left)
[Tue Jan 05 13:35:02] Player Left as a Player (0 players left)
Primary player removed. Shutting down
Back to top
View user's profile Send private message
Asparius



Joined: 18 Sep 2007
Posts: 52

PostPosted: Tue Jan 05, 2010 15:52    Post subject: Reply with quote

Hmmm - can you post your nwnx_odbc.txt here?
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Wed Jan 06, 2010 17:03    Post subject: Reply with quote

It's quite likely because of transactions. When you shut the server down cleanly, it should commit the transaction to the database. In a live module, it tends to be better to BEGIN and COMMIT transactions yourself at strategic times, to stop things from getting lost on a crash.
Back to top
View user's profile Send private message
abcd1234



Joined: 05 Jan 2010
Posts: 2

PostPosted: Thu Jan 07, 2010 17:40    Post subject: Reply with quote

My problem was rather stupid.
I did not start the game as multiplayer game.
I thought that a singleplayer game would connect automatically to the dedicated server of NWNX.
Now, when i connect to the server in NWN, it works fine.

Thanks for your time.
Additional question: is there any platform or program or tutorial about how to implement your own plug-in?

Greetz.
Back to top
View user's profile Send private message
Alassirana



Joined: 21 Jul 2011
Posts: 3

PostPosted: Thu Jul 21, 2011 18:10    Post subject: Reply with quote

I seem to be having this same problem, but I am connecting via multiplayer, and am trying to use the db through Shayan's Subrace System (StarryNight build). The database never updates. I have the sha_subr_consts (I think that's the name of the file) pointing to sqlite.db but nothing happens. Nothing happens if I try to have it create another database. I'm not sure what I'm doing wrong, as I've followed all of the instructions I can find. I've even tried not only my own module, but the Starry Night's demo module, and I find I have the same problem.

The most recent try has the ODBC log stating as follows:

___

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: CREATE TABLE IF NOT EXISTS sqlite(player varchar(255) not null default '', tag varchar(255) not null, name varchar(255) not null, val text not null default '', expire int(8) not null default 0, PRIMARY KEY(player, tag, name))
! SQL Error: near "NOT": syntax error
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_aasimar'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_aasimar'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_aasimar'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: INSERT INTO sqlite(player,tag,name,val) VALUES ('Nierna','test','sbrce_aasimar','11')
! SQL Error: no such table: sqlite
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_id_0x0000001c_uitem'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_id_0x0000001c_uitem'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: INSERT INTO sqlite(player,tag,name,val) VALUES ('Nierna','test','sbrce_id_0x0000001c_uitem','1')
! SQL Error: no such table: sqlite
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrce_id_0x0000001c_uitem'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: INSERT INTO sqlite(player,tag,name,val) VALUES ('Nierna','test','sbrce_id_0x0000001c_uitem','1')
! SQL Error: no such table: sqlite
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrcelto_d_aasimar'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: SELECT val FROM sqlite WHERE player='Nierna' AND tag='test' AND name='sbrcelto_d_aasimar'
! SQL Error: no such table: sqlite
o Sent response (0 bytes):
o Got request: INSERT INTO sqlite(player,tag,name,val) VALUES ('Nierna','test','sbrcelto_d_aasimar','1')
! SQL Error: no such table: sqlite
o Disconnecting from database.


--I'm not sure how to fix this.

Alassirana
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Fri Jul 22, 2011 15:38    Post subject: Reply with quote

Hm, I wonder if the "CREATE TABLE IF NOT EXISTS" syntax works in sqlite? Try removing the IF NOT EXISTS section from wherever it appears in the script, running the module once, then removing the line entirely.
Back to top
View user's profile Send private message
Alassirana



Joined: 21 Jul 2011
Posts: 3

PostPosted: Fri Jul 22, 2011 19:38    Post subject: Reply with quote

This may sound really crazy, but when I try modifying the line, it builds as it should, but my errors in the odbc log do not change, as if there's something that is keeping that in memory, even though the program has changed, and I don't know how to change it.
Back to top
View user's profile Send private message
Alassirana



Joined: 21 Jul 2011
Posts: 3

PostPosted: Sat Jul 23, 2011 21:59    Post subject: Reply with quote

Ok, I'm not going to try changing anything again, just yet, without knowing how to fix it...(especially as when using the sqlite db it didn't seem to effect anything). However, I've downloaded the mysql, and set that up, and run into a different error, but in the same line of code. I'll paste that here for perusal, so that you can help me figure out how to fix it.

string sSQL = "CREATE TABLE IF NOT EXISTS " + sTableName + "(player varchar (255) not null default ' ', tag varchar (255) not null, name varchar (255) not null, val text not null default ' ', expire int (8) not null default 0, PRIMARY KEY (player, tag, name))";
SQLExecDirect (sSQL);

The problem I'm having is as follows:

! SQL Error: BLOB/TEXT column 'val' can't have a default value

Val text is used a few lines down, but it could cause problems if I took it off...

(follows the line where the val is used)
string sSQL = "SELECT val FROM " + sCampaignName + " WHERE player ='" + sPlayer + "' AND tag='" +sCharName +"' AND name='" + sVarName + "'";

If anyone could give me pointers on how to get this thing working, please do. I at least made sure that mysql is reading things, it just doesn't know how to imput them, with these errors in the code.

Alassirana
Back to top
View user's profile Send private message
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Tue Jan 10, 2012 20:18    Post subject: Reply with quote

So... I'm using NWNX to restart my module, and I just implemented SQLite databases via nwnx_odbc. Everything works fantastic while the server is running, but upon a reset everything is lost.

I see you mentioning COMMIT, but how do I actually COMMIT the database changes? I'm not seeing any syntax.

Would it be

SetVarString(GetModule(), "NWNX!ODBC!COMMIT", "1")?

Int? Completely unsure.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Tue Jan 10, 2012 22:19    Post subject: Reply with quote

SetLocalString(GetModule(), "NWNX!ODBC!EXEC", "COMMIT")

Or set autocommit=1 in the mysql settings
Or do SetLocalString(GetModule(), "NWNX!ODBC!EXEC", "SET AUTOCOMMIT=1") on module load.
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Sat Mar 10, 2012 18:50    Post subject: Reply with quote

Not sure if committing myself works:
Code:
o Got request: COMMIT
! SQL Error: SQL logic error or missing database

But the autocommit line (OnModuleLoad) isn't working for me:
Code:
o Got request: SET AUTOCOMMIT=1
! SQL Error: near "SET": syntax error
o Got request: SETAUTOCOMMIT=1
! SQL Error: near "SETAUTOCOMMIT": syntax error
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Mon Mar 26, 2012 21:29    Post subject: Reply with quote

Bump? Data still being lost, frustratingly enough.

Even setting autocommit in the .ini I love about the last 3-4 hours of data prior to a reset.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
addicted2rpg



Joined: 01 Aug 2008
Posts: 106

PostPosted: Tue Apr 03, 2012 2:41    Post subject: Reply with quote

I have had projects in the past that detect the type of DB being used (MySQL, SQLlite, or SQL-Server, for example) and generate appropriately formatted SQL depending on the type used by the client.

I recall that there were quite a few significant differences between MySQL and SQLlite -- DON'T assume "everything" works the same. I haven't worked on databases in years, so things change, but I do recall there were some pretty significant differences so check your SQLite documentation carefully.

Also make sure you remember your semi-colons.
Don't go:
sSQL = "COMMIT";
SQLExecDirect(sSQL);

use:

sSQL = "COMMIT;";
instead. For good form and good practices, even if a NULL or EOF character in the stream used in some implementations middleware of passing data to the DB signals that your line is done, do not rely on such things for best compatibility.
Back to top
View user's profile Send private message
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Thu Apr 05, 2012 6:30    Post subject: Reply with quote

No Juice here.

Any other suggestions?
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Greyfort



Joined: 20 Jul 2010
Posts: 66

PostPosted: Wed Apr 11, 2012 22:05    Post subject: Reply with quote

Werehound, I can help you with your issue i think. I had a simalr issue can you email me the log file. Greyfort_1@hotmail.com I will look it over and see what I can find.

Another thing to consider, and virusman probly would agree. your issue may be in the SQL code that you wrote.

I can look over your code, or possibly give you an example of code that works well enough. I have some examples on the vault. I learned how to code SQL from Rowells examples. And that was for ms accesses, sqlite,etc.

I will look for the vault link, you can also find by typeing in my name Greyfort in nwnvault.
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