Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Can't create model Oracle with developer tools

Hi,

I have oracle database mydb with 2 schemas test1 and test2. I connected to test1 but when I used the command line to create model of table customers on schema test1 phalcon model customers it says ERROR: Could not find driver. When I used http://127.0.0.1/webtools.php it lists all tables in the two schemas test1 and test 2 in field table name. And when I choose table customers to create model it says table customers not exists.

Note: When I created manually table customers model and fetched it's data the model returns data correctly. So I want to ask is there a problem between oracle and phalcon developer tools

'database' => array(
    'adapter' => 'oracle',
    "dbname" => "//192.168.1.20:1521/mydb",
    "username" => "test1",
    "password" => "xxxxxxx",
    'charset' => 'AL32UTF8',
    'schema'  => 'TEST1'
),

I am using phalcon version 2 Thanks



34.1k

This is the configuration that uses my project

'database' => array(
    'adapter'     => 'Oracle', 
    'username'    => 'SPOLS',
    'password'    => 'SPOLS',        
    'dbname'      => 'localhost/xe',
    'schema'      => 'SPOLS'
    ),


34.1k

In ubuntu you must not load PDO_OCI and Phalcon directly in php.ini, load 2 files in

/etc/php5/cli/conf.d/30-phalcon.ini
/etc/php5/cli/conf.d/40-pdo_cli.ini

And in each file respectively phalcon.so and add extension = extension = pdo_oci.so

Also for web, in php.ini should not be references to these extensions

edited Apr '16

Thanks for your prompt reply. But is there any tips for windows installation



34.1k

If you have activated PDO_OCI in PHPinfo

yes it is enabled

  • PDO Driver for OCI 8 and later | enabled
  • ODBC Connection Pooling | Enabled, strict matching

And when I created the model manually without dev tools. I created search action and it retreives data correctly.

Hi, I tried to enable extension=php_pdo_oci.dll and extension=php_pdo_odbc.dll in both ~\apache2.4.9\bin\php.iniand ~\php5.5.12\php.ini. It was enabled in the php.ini of apache folder only. But now I enabled it in the both files.

The result is that the command phalcon model customers doesn't says ERROR: Could not find driver but it take along time without response and if I entered wrong table name e.g. phalcon model customerssssssssssssssssssss it says Error: Table "customerssssssssssssssssssss" does not exist which means it can connect to the database. But it takes along time without doing any thing and I click ctrl+c to break the script.

The interface of http://127.0.0.1/webtools.php still saying table doesn't exists for anything.

Thanks in advance



34.1k
Accepted
answer
edited Apr '16

Because you must specify the schema for Oracle.

phalcon model tablename --force --schema=schemaname

Oracle takes 10 to 20 minutes. I do not know why but it works. You just have to let it work

Thanks for your reply

I tried the command phalcon model tablename --force --schema=schemaname and it works but between 1.5 and 2 hours :)). Which is a very big time to run.

I tried also to convert oracle schema structure to mysql and set the comnnection to the mysql connection and run the commands I want. Then convert the database connection to use oracle. After using dev-tools.



34.1k

Well, I prefer to wait 2 hours compared to codify all code from the ground and try q takes work more

The big question now is why using dev-tools with oracle taking all this time. And is there any near fix for that issue.

Have you checked what is the bottleneck? Phalcon stand-alone tools CLI app, or the database (RDBMS) itself? I would guess that if you have large database with many tables, it will take time to build all the fileds, tables, relations from RDBMS -> Phalcon ORM.

Thanks for your reply stamster. I think you are right the reason is because of number of tables. There is an issue e..g if we have database with 2 schemas s1(5 tables),s2(20 tables)+ system(x tables)and I run the command phalcon model tablename --force --schema=schemaname using schema s1. I found using session browser of toad that this query runs on all tables in the database not the tables of s1 only.

SELECT AC.TABLENAME, CC.COLUMNNAME, AC.CONSTRAINTNAME, AC.ROWNER, RCC.TABLENAME RTABLENAME, RCC.COLUMNNAME RCOLUMNNAME

FROM ALL_CONSTRAINTS AC

JOIN ALLCONSCOLUMNS CC ON AC.CONSTRAINTNAME = CC.CONSTRAINTNAME JOIN ALLCONSCOLUMNS RCC ON AC.ROWNER = RCC.OWNER AND AC.RCONSTRAINTNAME = RCC.CONSTRAINTNAME

WHERE AC.CONSTRAINTTYPE = 'R' AND AC.OWNER = 'S1' AND AC.TABLENAME = 'WWVFLOWINSTALL_SCRIPTS' -- table name changing ...

So it waste alot of time in other schemas tables. and in the webtools.php if I gonna to create a model. It shows a list of all tables in the database not the tables of connected schema only.



34.1k

Yes, I have already discussed this little feature to the developer but as the system allows different database were making the correct settings. Currently, I use to solve the problem only commands in the terminal, hopefully for the next update is resolved