CakePHP 1.3 - Having problems baking with oracle - cakephp

The comand 'cake bake all' works fine when my database is MySQL, but it fails when I try to generate the mvc code using Oracle.
The application works as expected when the database.php file is modified to use my oracle database after to generate the mvc code using MySQL.
So I believe the oracle isn't the problem.
How can I get 'cake bake all' working when oracle is my default database?
database.php code:
var $default = array(
'driver' => 'oracle',
'persistent' => false,
'login' => 'LOGIN',
'password' => 'PASSWORD',
'database' => 'IP:1521/DATABASE'
);

You a have to make sure you are using proper database for the cakephp you are using and also supports the version of php and wamp / mamp / lampserver
then start configuration.
Databases supported by CakePHP
Find list of Databases supported by CakePHP from here
Find list of Drivers from here
and configure it. some thing like here Configure PHP-sqlsrv Wamp Server

Related

cant connect to database using cakephp and wampserver

I am using 64bit WampServer and cakephp 3.2 and win10. I have a new computer and need to transfer a cakephp project. There is a user Root with all privileges, with no password and database 'aptutori_apt4' n exists on phpmyadmin
The project loads if it doesnt need the database but this is what I get
error: sqlstate[hy000] [1049] unknown database 'aptutori_apt4'
I cant connect the database!
Is the host setting wrong ?
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'aptutori_apt4',
'encoding' => 'utf8',
'timezone' => '+11:00',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
It is the same settings as my other computer on phpmyadmin and app.php. The new computer shows on phpmyadmin under database tab Server:Mysql:3308
I think your problem is that recently mariaDB became the default database in WAMPServer, so therefore mariaDB is using port 3306 (the default for almost everything MySQL) and MySQL is listening on port 3308
However, if you want to use MySQL, the simple solution would be to swap the default database in WAMPServer, and of course there is a tool for that on the WAMPManager Menus.
Right-click Wampmanager icon -> Tools -> Invert default DBMS MariaDB <-> MySQL
Now MySQL will use port 3306 and mariaDB will use port 3307.
Now your cake config should work and find the correct DBMS on port 3306 and therefore the database you have created in there.
This is the safest solution as when you move code to a live server it will almost definitely have its MySQL/mariaDB configured to use port 3306 and you wont need to change anything in your config.
Alternatively
You could put the port number that MySQL is Listening on in this param
'port' => '3308',
But you will almost definitely have to change this when the site get moved to a Live Server, and then you dev code and your live code will be different, unless you remember not to transfer this file after the first time.
Oh and remember you can reverse this change in default database, just go back to the menus and the menu you used last time should say
Right-click Wampmanager icon -> Tools -> Invert default DBMS MySQL <-> MariaDB
Do that and you are back to mariaDB using port 3306

Drupal 7 utf8mb4 support: "Please convert tables" warning... after converting tables

The full error I am seeing in Drush is:
Please convert all database tables to utf8mb4 prior to enabling it in settings.php. See the documentation on adding [warning]
4 byte UTF-8 support for more information. (Currently using Database 4 byte UTF-8 support Enabled, but database
tables need conversion)
I'm using the most current version of Drupal 7. I've converted all tables to utf8mb4_unicode_ci. I did so at first manually through the prompt, but then ran the updates again using phpMyAdmin on tables and fields (just to make sure, since Drush was still telling me "Please convert all database tables to utf8mb4 prior to enabling it in settings.php.") All tables are set to InnoDB.
In the my.cnf file, I've ensured that I've got
[mysqld]
innodb_large_prefix=true
innodb_file_format=barracuda
innodb_file_per_table=true
Another site on the same server has utf8mb4 support enabled, and isn't throwing the error. Both sites are using latest version of PHP 5.6.x. Drush version is 8.1.2. MySql is at the latest version of 5.5.x.
I've cleared all Drupal caches via drush cc all & restarted the MySQL server. The setup is under Ubuntu with Plesk.
Looking for thoughts on what I might have missed and why Drupal is asking me to convert tables that look like they've been converted (phpMyAdmin indeed shows the collation as utf8mb4_unicode_ci.)
Pleasse see https://www.drupal.org/forum/support/upgrading-drupal/2018-04-03/upgrade-to-758-database-utf-8-issues#comment-12968331. This message is not from a deep sql analysis but hinged on the value of the boolean variable drupal_all_databases_are_utf8mb4. This variable needs to be set to TRUE after the tables have been converted whether you do it manually or by the recommended drush script (https://www.drupal.org/project/utf8mb4_convert) which (I think) will set it for you.
-Bronius
Do you have collation and charset set in settings.php?
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'databasename',
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
);

Install TYPO3 8.7.7 with SQL Server on IIS

I tried to install TYPO3 (8.7.7) on my Webserver (IIS) and I'd like to use my SQL Server instead of MySQL.
I found lots of instructions how to make this (on typo3.org and other websites) but none of these worked for me.
I found out, that I must install two extensions before I start the installation (ADOdb & DBAL). Probably there is my fault.
Can anybody explain step by step how to install these extensions before the TYPO3 installation?
I'm using the following configuration to successfully run TYPO3 on SQL Server on my local windows machine:
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf-8',
'dbname' => 't3',
'driver' => 'sqlsrv',
'host' => 'localhost',
'password' => 'yourPassword',
'port' => 1433,
'user' => 'sa',
],
],
],
It's a bit complicated to set up with the installer as it is not yet "clickable". What you can do is call the install script and when it's asking you to configure the database connection you go to your file system and manually add the config section above (with your connection params of course) in the LocalConfiguration.php file.
Then reload the installer - which should now recognize the configured database connection and let you go to the last step where you can import / create the base tables and data.
Note: At the moment I know of two bigger areas where SQL Server is still a problem with TYPO3 8.7 - that's workspaces and database compare. The last one means that after you have existing data in your SQL Server tables won't let you alter them via the TYPO3 database compare tool - you have to change tables manually if you need to.
Find a gist of the table create statements on https://gist.github.com/psychomieze/9570ea1f578aee7a1fbb68c3240a21c8
With 8.7, Doctrine DBAL has been integrated into the core and ADOdb & DBAL sysexts have been removed as there is no need anymore.
Take a look at the documentation of Doctrine DBAL http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html and it should fit perfectly to the configuration of the DB in `LocalConfiguration.php``
'DB' => [
'Connections' => [
'Default' => [
'charset' => 'utf8',
'dbname' => 'typo3',
'driver' => 'mysqli',
'host' => 'mysql',
'password' => 'dev',
'port' => 3306,
'user' => 'root',
],
],
],
Now my Typo3 is working.
I solved my problem a little bit complicated.
I made a test environment and installed Typo3 with MySQL.
Then I copied the database with the "Microsoft SQL Server Migration Assistant 7.6 for MySQL"
(https://www.microsoft.com/en-us/download/details.aspx?id=54257) to my main environment.
After that I copied all the created folders (typo3conf, typo3temp etc.) to my main environment
and edited the databaseconnection in the LocalConfiguration.php file like Georg Ringer proposed.
When I am installing Typo3 and MSSQL next time I will do it like susi proposed.
Thanks for your help.

Use Cakephp 2.4.4 with oracle?

Can I use CakePHP 2.4.4 with Oracle database? I looked in
Model/Datasource/Database/ there only seems to be support for Mysql,
Postgres, Sqlite, Sqlserver. But working with an existing Oracle
database is my job's requirement. I would be thankful for any tips.
Thank you.
No it's not possible. Well, not if you want to use some official driver. You can find a driver here : http://searchcode.com/codesearch/view/40032847
You will probably have to make some modifications to this driver to be able to make more complex queries.
In your config file, you will need to add your database connection information this way :
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Oracle',
'driver' => 'oracle',
'persistent' => false,
'host' => 'hostname',
'login' => 'username',
'password' => 'yourpassword',
'database' => '(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521)))(CONNECT_DATA=(SID=mysid)))',
'prefix' => '',
);
Also it does not support using a different schema than the one you log in with so you need to create a trigger on your db to switch automatically to the schema you want to work with on login.
I hope this helps in getting you started.
I would suggest you use Zend instead of Cakephp.
Also see this post :
Using Oracle database with CakePHP 2.0

CakePHP 2.0 database connection issue

I'm using a standard MySQL db on my server and trying to connect my install of CakePHP 2.0 to it. I'm using this for my settings:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'unix_socket' => '/tmp/mysql.sock',
'login' => 'mylogin',
'password' => 'mypw',
'database' => 'mydb',
);
But my cakephp page comes up as cannot connect to the database. I've set debug to 2, but how do I find out what is the issue with the database connection?
I've also tried a normal mysql connect in a .ctp file and it works fine with the login/password I give it...
It could be that you dont not have the PDO_Mysql extension enabled, as thats what CakePHP 2.0 uses.
Try to create a small script outside of CakePHP, to see if this is enabled. And try to connect to the database with:
http://ie2.php.net/manual/en/pdo.construct.php

Resources