I am new in oracle and fuelphp, simple question, how to set connection fuelphp framework with oracle DB, documentation only for mysql and postgresql :
// a MySQL driver configuration
'development' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => 'localhost',
'port' => '3306',
'database' => 'fuel_db',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
'readonly' => false,
),
// a PDO driver configuration, using PostgreSQL
'production' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'pgsql:host=localhost;dbname=fuel_db',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '"',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
'readonly' => array('slave1', 'slave2', 'slave3'),
)
how to connect with oracle? thank you
Working from the PostgreSQL PDO example you posted I would try this:
'production' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'oci:dbname=//hostname:port/database',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '"',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
'readonly' => false
)
Just be sure that you've correctly installed & configured the PHP OCI drivers.
Related
I need to connect sybase with codegniter 4 and all searches lead to version 3, is there any solution to use sybase in codegniter 4?
Database
public $default = [
//'DSN' => 'odbc:Driver={Adaptive Server Enterprise};',
//'DSN' => 'pdo://root:qwe123#localhost:6100/root',
'DSN' => 'odbc:Driver={Adaptive Server Enterprise};Server=localhost;port=6100;Database=db_pm',
'hostname' => 'localhost',
'username' => 'root',
'password' => 'qwe123',
'database' => 'db_teste',
'DBDriver' => 'Sybase',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'development'),
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 6100,
];
I am just getting into PHP and I'm trying to get a server started and go through CakePHP's CMS tutorial. However I cannot get a database connection. I get the error: CakePHP is NOT able to connect to the database.
Connection to database could not be established: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
I have been trying to edit my app/config/app.php file. This is what I have:
'Datasources' => [
'default' => [
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'host' => 'localhost',
'port' => '3306',
'username' => 'root',
'password' => 'THE DEFAULT PASSWORD I USED TO GET INTO phpMyAdmin',
'database' => 'cake_cms',
'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_URL', null),
],
'test' => [
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'host' => 'localhost',
'port' => '3306',
'username' => 'root',
'password' => 'THE DEFAULT PASSWORD I USED TO GET INTO phpMyAdmin',
'database' => 'cake_cms',
'unix_socket' => '/opt/bitnami/mysql/tmp/mysql.sock',
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
],
Thanks in advance. I'm super new, so maybe I need to provide more information.
I run wamp and try to connect to db but I got
Unable to connect to your database server using the provided settings.
Few faqs / what I've done:
I autoloaded the database library in config.php
my phpMyAdmin doesn't have any username and pass set
this is the setting in database.php
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => 'ciintro',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
'username' => '',
should be
'username' => 'root',
check username.
I think you are newer to codeigniter.
'username' => 'root' ( root or whatever you set for PHPMYADMIN.)
'password' => 'password' ( password or whatever you set for PHPMYADMIN.)
I'm using FuelPHP and I can't set up my database so it would work. I know that i'm using right information but i'm not sure if I put it in right place.
<?php
return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=modernt#moderntalking.lt;dbname=modernt',
'username' => 'modernt',
'password' => 'pass',
),
),
);
This is my db.php in APP/config/db.php
Environment configurations are merged, and the environment wins.
So if you have ./app/config/db.php containing return array('a'); and you'll have ./app/config/development/db.php containing return array('b');, then after reading your config, you'll end up with "b".
So if you use environment based config (like DB does by default), only add configuration to the global file that is truely global, otherwise it gets overwritten in the merge.
Check this
'dsn' => 'mysql:host=moderntalking.lt;dbname=modernt',
// a MySQL driver configuration
'development' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => 'localhost',
'port' => '3306',
'database' => 'fuel_db',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
'readonly' => false,
),
// a PDO driver configuration, using PostgreSQL
'production' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'pgsql:host=localhost;dbname=fuel_db',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '"',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
'readonly' => array('slave1', 'slave2', 'slave3'),
),
'slave1' => array(
// configuration of the first production readonly slave db
),
'slave2' => array(
// configuration of the second production readonly slave db
),
'slave3' => array(
// configuration of the third production readonly slave db
),
Basic procedure of setup FuelPHP..may be its help you .Thank you
First, check your environment configuration in app/bootstrap.php:
/**
* Your environment. Can be set to any of the following:
*
* Fuel::DEVELOPMENT
* Fuel::TEST
* Fuel::STAGING
* Fuel::PRODUCTION
*/
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::DEVELOPMENT);
Then modify the db.php file accordingly (app/development/db.php, app/production/db.php, app/staging/db.php, app/test/db.php)
I'm trying to setup my fuelphp on ubuntu12, nginx in a development environment.
Everything was working for me except when I try to do php oil refine migrate.
I was faced with the following error message:
Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 94
My development/db.php:
return array(
'default' => array(
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=fuel_intro',
'username' => 'root',
'password' => '',
),
),
);
I searched the Internet and fuelphp docs, and still no luck.
Any help will be appreciated.
It seems you're doing database configuration incorrectly. It shouldn't be 'host:localhost', it should be like 'hostname'=>'localhost'. And please use mysql or PDO instead of mysql... (because mysql_* functions are deprecated.
It should be something like:
'default' => array(
'type' => 'mysqli',
'connection' => array(
'hostname' => 'localhost',
'port' => '3306',
'database' => 'fuel_db',
'username' => 'your_username',
'password' => 'y0uR_p#ssW0rd',
'persistent' => false,
'compress' => false,
),
'identifier' => '`',
'table_prefix' => '',
'charset' => 'utf8',
'enable_cache' => true,
'profiling' => false,
),
Take a look at:
http://fuelphp.com/docs/classes/database/introduction.html for further information.