Raised This Month: $51 Target: $400
 12% 

Plugin says: unable to open database file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 02-22-2015 , 17:40   Plugin says: unable to open database file
Reply With Quote #1

Code:
L 02/22/2015 - 23:07:23: Info (map "cs_italy_mini") (file "addons/amxmodx/logs/error_20150222.log")
L 02/22/2015 - 23:07:23: [AMXX] Plugin ("ttt_antiretry_system.amxx") is setting itself as failed.
L 02/22/2015 - 23:07:23: [AMXX] Plugin says: unable to open database file
L 02/22/2015 - 23:07:23: [AMXX] Run time error 1 (plugin "ttt_antiretry_system.amxx") - forced exit
Build ID: 4616:5a7752a

I'm having issues with MySQL module using sqlite. It happens randomly, every couple of maps. What is the problem?
Code(1 mysql, 2 sqlite):
PHP Code:
public MySQL_Init()
{
    new 
cvar get_pcvar_num(cvar_stats);
    if(
cvar == 1)
    {
        new 
host[64], user[33], pass[32], db[32];
        
get_cvar_string("amx_sql_host"hostcharsmax(host));
        
get_cvar_string("amx_sql_user"usercharsmax(user));
        
get_cvar_string("amx_sql_pass"passcharsmax(pass));
        
get_cvar_string("amx_sql_db"dbcharsmax(db));
        
g_pSqlTuple SQL_MakeDbTuple(hostuserpassdb);
    }
    else if(
cvar == 2)
    {
        
SQL_SetAffinity("sqlite");
        
g_pSqlTuple SQL_MakeDbTuple("localhost""root""""ttt_db");

    }
    else 
set_fail_state("[TTT] CVAR set wrongly, plugin turning off!");

    new 
error[128];
    new 
codeHandle:connection SQL_Connect(g_pSqlTuplecodeerrorcharsmax(error));
    if(
connection == Empty_Handle)
        
set_fail_state(error);

    new 
Handle:queries;
    if(
cvar == 1)
    {
        
queries SQL_PrepareQuery(connection
            
"CREATE TABLE IF NOT EXISTS ttt_stats(\
                id int unsigned NOT NULL AUTO_INCREMENT, \
                player_name varchar(40) UNIQUE NOT NULL default '', \
                gwk int(10), \
                kills_i int(10), \
                kills_d int(10), \
                kills_t int(10), \
                rdm int(10), \
                innocent int(15), \
                detective int(10), \
                traitor int(10), \
                bomb_planted int(10), \
                bomb_exploded int(10), \
                bomb_defused int(10), \
                total_points int(32), \
                PRIMARY KEY (id)\
            );"
        
);
    }
    else if(
cvar == 2)
    {
        
queries SQL_PrepareQuery(connection
            
"CREATE TABLE IF NOT EXISTS ttt_stats(\
                id INTEGER PRIMARY KEY, \
                player_name CHAR(40) UNIQUE NOT NULL default '', \
                gwk INTEGER, \
                kills_i INTEGER, \
                kills_d INTEGER, \
                kills_t INTEGER, \
                rdm INTEGER, \
                innocent INTEGER, \
                detective INTEGER, \
                traitor INTEGER, \
                bomb_planted INTEGER, \
                bomb_exploded INTEGER, \
                bomb_defused INTEGER, \
                total_points INTEGER\
            );"
        
);
    }

    if(!
SQL_Execute(queries))
    {
        
SQL_QueryError(querieserrorcharsmax(error));
        
set_fail_state(error);
    }

    
SQL_FreeHandle(queries);
    
SQL_FreeHandle(connection); 

__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-22-2015 , 18:08   Re: Plugin says: unable to open database file
Reply With Quote #2

Do you have SELinux enabled? if so, disable it.
__________________

Last edited by Arkshine; 02-22-2015 at 18:09.
Arkshine is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 02-23-2015 , 02:06   Re: Plugin says: unable to open database file
Reply With Quote #3

After doing little research on SELinux, I think I'm not using it. I have Ubuntu 14.04.1. While searching about SELinux, found out that default protection in Ubuntu is AppArmor, but after finding commands, it showed that apparmor module is not loaded.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 02-28-2015 at 14:59.
GuskiS is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 02-28-2015 , 14:57   Re: Plugin says: unable to open database file
Reply With Quote #4

So?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-28-2015 , 15:40   Re: Plugin says: unable to open database file
Reply With Quote #5

So, it could sound like a permission issue too.
__________________
Arkshine is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 02-28-2015 , 17:27   Re: Plugin says: unable to open database file
Reply With Quote #6

What kind of permissions are you reffering to?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-28-2015 , 17:48   Re: Plugin says: unable to open database file
Reply With Quote #7

I'm not sure, like the user/group you're using for HLDS doesn't have the access to write in the directory where the database is. It's likely a permission issue. You should check it (/tmp too in case).
__________________

Last edited by Arkshine; 02-28-2015 at 17:49.
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode