0

I'm trying to create a Catalyst project connecting to an existing MS SQL Server database. I got the correct connection string and it's authenticating, but it's not finding any tables. Anyone have an idea of what I might be missing?

I substituted the real ip address, database name, username, and password but you get the idea.

This is the command I run:

script\qa_utility_create.pl model DB DBIC::Schema QA_Utility::Schema create=static "db_schema=DatabaseName" "dbi:ODBC:Driver={sql server};Server=1.1.1.1,1433;Database=DatabaseName" username password

When I run this, I get the below error:

exists "C:\strawberry\perl\site\bin\QA_Utility\lib\QA_Utility\Model"
exists "C:\strawberry\perl\site\bin\QA_Utility\t"
Dumping manual schema for QA_Utility::Schema to directory C:\strawberry\perl\site\bin\QA_Utility\lib ...
Schema dump completed.
WARNING: No tables found, did you forget to specify db_schema?
exists "C:\strawberry\perl\site\bin\QA_Utility\lib\QA_Utility\Model\DB.pm"
derekmw
  • 375
  • 1
  • 5
  • 13

2 Answers2

1

Check your db_schema as the error suggests. The default is usually "dbo".

Richard Huxton
  • 21,516
  • 3
  • 39
  • 51
  • Do you mean by check the actual schema of my DB I'm trying to connect to? If so, yes, I can view (what I assume is equivalent in MS SQL) the Information_Schema view which shows all my tables information: table_catalog, table_schema, table_name, and table_type. Also there are views to see the columns/data type etc. – derekmw Sep 11 '12 at 14:02
  • No, a table name is typically specified as "dbo.user_table" or some such. The "dbo" is the schema-name. – Richard Huxton Sep 11 '12 at 17:50
  • I didn't realize dbo was the schema name, I thought that just stood for database owner. Thank you so much for the help. That fixed my issue. I just needed to change db_schema=dbo and got it to work! – derekmw Sep 12 '12 at 15:09
0

So I had similar issues connecting with a mySQL database which drove me crazy for about 4 hours (I'm a newbie to Catalyst).

the create script was executing ok, but failed to pick up any tables giving the "WARNING No tables found...."

The tables were present however in the database.

Prior to this, I had been getting errors when the script tried to connect to the database, and after playing with the arguments for a while, the connection errors cleared and I assumed all was good at this point (wrong !!!!).

The suggested solution to specify the db_schema was misleading at this point, as the problem was more an issue with the connection failing to return any valid data. So I think what was happening was it was finding the database, connecting ok, but not returning any data, thus no tables....

After about 4 hours of playing with the arguments for the connection one combination just magically worked.

So here is the successful command line....

script/testcatalyst_create.pl model DB DBIC::Schema testcatalyst::Schema::perl_test create=static dbi:mysql:perl_test:user=root

The parameter which was causing the error was the last parameter which specifies the connection parameters dbi:mysql...

previously I had tried... script/testcatalyst_create.pl model DB DBIC::Schema testcatalyst::Schema::perl_test create=dynamic dbi:mysql:perl_test,username=root

and many other formats from various online searches. The ":user=root" turned out to be the correct format.

Hope this helps someone else !!!!!!!

Rob
  • 421
  • 4
  • 2