View previous topic :: View next topic |
Author |
Message |
abcd1234
Joined: 05 Jan 2010 Posts: 2
|
Posted: Tue Jan 05, 2010 15:03 Post subject: NWNX2 database doesn't update |
|
|
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 |
|
|
Asparius
Joined: 18 Sep 2007 Posts: 52
|
Posted: Tue Jan 05, 2010 15:52 Post subject: |
|
|
Hmmm - can you post your nwnx_odbc.txt here? |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Wed Jan 06, 2010 17:03 Post subject: |
|
|
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 |
|
|
abcd1234
Joined: 05 Jan 2010 Posts: 2
|
Posted: Thu Jan 07, 2010 17:40 Post subject: |
|
|
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 |
|
|
Alassirana
Joined: 21 Jul 2011 Posts: 3
|
Posted: Thu Jul 21, 2011 18:10 Post subject: |
|
|
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 |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Fri Jul 22, 2011 15:38 Post subject: |
|
|
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 |
|
|
Alassirana
Joined: 21 Jul 2011 Posts: 3
|
Posted: Fri Jul 22, 2011 19:38 Post subject: |
|
|
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 |
|
|
Alassirana
Joined: 21 Jul 2011 Posts: 3
|
Posted: Sat Jul 23, 2011 21:59 Post subject: |
|
|
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 |
|
|
werehound
Joined: 17 Aug 2010 Posts: 41
|
Posted: Tue Jan 10, 2012 20:18 Post subject: |
|
|
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 |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Tue Jan 10, 2012 22:19 Post subject: |
|
|
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 |
|
|
werehound
Joined: 17 Aug 2010 Posts: 41
|
Posted: Sat Mar 10, 2012 18:50 Post subject: |
|
|
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 |
|
|
werehound
Joined: 17 Aug 2010 Posts: 41
|
Posted: Mon Mar 26, 2012 21:29 Post subject: |
|
|
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 |
|
|
addicted2rpg
Joined: 01 Aug 2008 Posts: 106
|
Posted: Tue Apr 03, 2012 2:41 Post subject: |
|
|
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 |
|
|
werehound
Joined: 17 Aug 2010 Posts: 41
|
Posted: Thu Apr 05, 2012 6:30 Post subject: |
|
|
No Juice here.
Any other suggestions? |
|
Back to top |
|
|
Greyfort
Joined: 20 Jul 2010 Posts: 66
|
Posted: Wed Apr 11, 2012 22:05 Post subject: |
|
|
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 |
|
|
|
|
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
|