Menu

#5 Case mismatch on table names

closed
nobody
None
2014-07-16
2014-04-08
Anonymous
No

Originally created by: kollegeJack

Hey There,

I am using Bacula Version 5.2.6 and latest Reportula. Cron and userfrontend displaying following error:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bacula.client' doesn't exist (SQL: select * from `client`)

My tables all starts with an uppercase letter (e.g. my client table is Client). I don't want to change the table names because I don't know what kind of problems that causes on bacula itself. Is there any idea or fix for that available?

Related

Tickets: #8

Discussion

  • Anonymous

    Anonymous - 2014-04-09

    Originally posted by: oliveiraped

    Hi this is not the best solution but it works in app/models/CLient.php model file change " protected
    $table = 'client'; " to "protected $table = 'Client';".

    or the other thing you do is change on MySql database settings this:

    Try adding/editing "lower_case_table_names = 2" in my.ini or my.cnf .

    You can google'it to see more information about the issue.

    Before do that backup you database.

     
  • Anonymous

    Anonymous - 2014-04-09

    Originally posted by: kollegeJack

    Is that my fault that my table names always starting uppercase or is this a bacula default?

     
  • Anonymous

    Anonymous - 2014-04-09

    Originally posted by: oliveiraped

    I had that problem when i migrated from MySQL database to PostgreSQL, database on Reportula 1 development. On Reportula 2 i used Laravel framework that has ORM component, that abstracts you from the database. I don't think it's your fault. May be it's Bacula database creation script it different from MySQL to PostgreSQL, but i am not sure.

     
  • Anonymous

    Anonymous - 2014-04-10

    Originally posted by: kollegeJack

    Okay thanks! I fixed the table names in the different models. But now I get the following error:
    reportula error

     
  • Anonymous

    Anonymous - 2014-06-17

    Originally posted by: k0ssi

    same error here, i tried to edit Tablenames manualy in .php files but im unable to find each string.
    Setting "lower_case_table_names = 2" want work in my case.

     
  • Anonymous

    Anonymous - 2014-06-28

    Originally posted by: ricardo777

    Same issue for me with clean bacula installation on Ubuntu 14.04 setting "lower_case_table_names = 2" does not work for me.

    Then I get the error in mysql SQL show index from BaseFiles failed : Table 'bacula.basefiles' doesn't exist

     
  • Anonymous

    Anonymous - 2014-07-08

    Originally posted by: oliveiraped

    Open terminal and edit /etc/mysql/my.cnf
    sudo nano /etc/mysql/my.cnf

    Underneath the [mysqld] section.add:
    lower_case_table_names = 1

    Restart mysql
    sudo /etc/init.d/mysql restart

    Then check it here:
    mysqladmin -u root -p variables

    Try with 1, if does not work you have to change o table names on the models app files !

     
  • Anonymous

    Anonymous - 2014-07-09

    Ticket changed by: oliveiraped

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: westphala

    1 also do not work for me.
    do you plan to create a patch of the code for that?

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: asyd

    Hi,

    imho the application should be aware of table case name, since Bacula create 'Client', (and not 'client'), reportula should use 'Client' by default.

    Changing a global server parameter for an application sounds a bit stange.

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: oliveiraped

    Yes its true, but in my case i have my infrastruture in Portgresql Database, and i am developing based on postgres database, on mysql i did that workaround.

    Anyone can contribute to solve that problem.

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: asyd

    Ok.

    Well, sounds like changing model is not enough, after change every bacula related table names in models, i still have an exception:

    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bacula.file' doesn't exist (SQL: select count(*) AS filesNumber from `file`)

    Why the name defined in protected table is not used?

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: westphala

    Same here
    i changed protected $table = 'client'; to protected $table = 'Client'; and get still this error:
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bacula.client' doesn't exist (SQL: select * from Client)
    do i must change this entry also in other files as under app/models?

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: oliveiraped

    My Mysql Database

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 674
    Server version: 5.5.37-0ubuntu0.14.04.1 (Ubuntu)

    My Postgres Database

                                                      version
    

    PostgreSQL 8.4.21 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
    (1 row)

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: asyd

    I think you have lower_case_table_names = 1 when you create the bacula database, right?

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: oliveiraped

    Problably i had but i am not certain ...

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: asyd

    hmm, which version of bacula are you using?

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: oliveiraped

    The latest comunity version 7.0.4, but i am using bacula since Version 3 só i am being upgrading the database since then.

     
  • Anonymous

    Anonymous - 2014-07-11

    Originally posted by: asyd

    Is mysql support was tested? I create tables with lower_case_table_names = 1, then start to use bacula, but after only two jobs, when hitting the dashboard I have:

    ErrorException
    Undefined index: jobfiles

    in reportula/vendor/laravel/framework/src/Illuminate/Support/helpers.php

     
  • Anonymous

    Anonymous - 2014-07-16

    Originally posted by: Raphiusks

    Hi there.

    I'm having the exact same issue as asyd reported. Do you happen to have any suggestions?

    Was really looking forward to trying reportula. Obrigado!

     

Log in to post a comment.

MongoDB Logo MongoDB