Server Talk > Scripting Releases

libdb (SQLite / MySQL / MariaDB / PostgreSQL / ODBC library)

<< < (3/8) > >>

Mighty:
OK, further problems. Linux this time.

 - Ubuntu 12.04 x84_64, FAT32
 - Installed 32-bit libraries
 - All the files have maximum permissions
 - I have installed libiodbc
 - echo $LD_LIBRARY_PATH gives me ~/server/, which is exactly where soldatserver and libdb.so are
 - running server with -safe 0 option
 - using correct .pas file with .so library instead of .dll

Still...

--- Code: ---
             -= Soldat Dedicated Server 1.6.3 - 2.7.3 =-

----------------------------------------------------------------
         Soldat Dedicated Server initializing...
----------------------------------------------------------------

   Need help running your server?
   IRC: #soldat.devs @ irc.quakenet.org

   ---> http://forums.soldat.pl/

   Additional parameters:
   ./soldatserver -p PORT -l MAXPLAYERS -k PASSWORD
   Example: ./soldatserver -p 23073 -l 16 -k "my pass"

Using Indy 9


 Hit CTRL+C to Exit
 Please command the server using the Soldat Admin program
Welcome to Soldat 1.6.3
 Server name: Soldat Server
 Server PID: 11627
 [*] ScriptCore v2.4 loaded! Found 1 scripts...
 [*] Compiling libdb -> libdb_linux.pas...
Server Encountered an error:
Unable to find variable
Shutting down server...
Shutting down admin server...
Shutting down ScriptCore...

--- End code ---

If mods find this post connected with using .dlls more than just libdb, let me know/move to appropriate.

SyavX:
Try to re-install libiodbc (it conflicts with unixODBC and may require removal of some dependencies):

--- Code: ---apt-get install libiodbc2
--- End code ---

Mighty:
Even more.

So I had a problem making soldatserver see a .so file on Debian, but it worked after editing /etc/ld.so.conf, adding a path to the .so file. So Soldat sees it now, but...

 - proper permissions
 - iodbc and libiodbc (re)installed
 - drivers() says there are no, but that's not the case, since it says so on my local machine and still everything works just fine.


--- Code: --- [*] ScriptCore v2.4 loaded! Found 3 scripts...
(22:35:30)   ...
(22:35:30)  [*] Compiling CWSystem2 -> libdb_linux.pas...
(22:35:30)  [*] Compilation Complete.
(22:35:31) /create1 (83.6.220.140)
(22:35:31) Failed to open database

--- End code ---

I run out of ideas. Completely.

SyavX:
I assume you've changed an example, as there was no "Failed to open database" message in the original script. So, I need to see your code to say something more specific.

If you just added an error output for the if DB_Open() statement:

--- Code: --- if DB_Open(0, db_path, '', '', DB_Plugin_SQLite) <> 0 then
begin
WriteLn('Database "'+db_path+'" opened...');
CheckDatabaseUpdate(0, 'CREATE TABLE IF NOT EXISTS test(id INTEGER PRIMARY KEY, name STRING, value INTEGER);');
CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES("name1", 5);');
CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES("name2", 10);');
CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES(''name3'', 15);');
WriteLn('Values inserted...');
DB_Close(0);
WriteLn('Database "'+db_path+'" closed...');
end
else
WriteLn('Failed to open database');
--- End code ---
then you should try to test file creating/reading with scripts on your server. Here is a simple example: WriteFile.
I suppose that database file you are trying to open was not created. As you can see, there is no error check after using of WriteFile() in my example:

--- Code: --- if Not FileExists(db_path) then
if WriteFile(db_path,'') then
WriteLn('File "'+db_path+'" created...');
--- End code ---

Mighty:
Yes, I just added an "else" to see that it actually tries to execute. It didn't say that the file was created because that was not the first run, I've been testing with WriteFile and ReadFile, both work.

Here's the code anyway:

--- Quote ---procedure create_db1();
var
  db_path: String;
begin
   db_path:= 'test.db';
   //creating a new file if not exists
   if Not FileExists(db_path) then
      if WriteFile(db_path,'') then
         WriteLn('File "'+db_path+'" created...')
        else
            WriteLn('Failed to create file');
   
   if DB_Open(0, db_path, '', '', DB_Plugin_SQLite) <> 0 then
   begin
      WriteLn('Database "'+db_path+'" opened...');
      CheckDatabaseUpdate(0, 'CREATE TABLE IF NOT EXISTS test(id INTEGER PRIMARY KEY, name STRING, value INTEGER);');
      CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES("name1", 5);');
      CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES("name2", 10);');
      CheckDatabaseUpdate(0, 'INSERT INTO test(name, value) VALUES(''name3'', 15);');
      WriteLn('Values inserted...');
      DB_Close(0);
      writeln('Database "'+db_path+'" closed...');
   end
    else WriteLn('Failed to open database')
end;   
--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version