Replies: 2 comments 1 reply
-
Hi @Veritexx , may I know do you solve this issue ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
It's possible to have multiple connections and the config looks correct: return [
'main' => [
'driver' => 'oracle',
'tns' => 'XE',
'host' => '127.0.0.1',
'port' => '1521',
'database' => 'XE',
'username' => 'laravel',
'password' => 'xxx',
'charset' => 'AL32UTF8',
'prefix' => 'HIS_',
'prefix_schema' => '',
],
'sales' => [
'driver' => 'oracle',
'tns' => 'XE',
'host' => '127.0.0.1',
'port' => '1521',
'database' => 'XE',
'username' => 'laravel',
'password' => 'xxx',
'charset' => 'AL32UTF8',
'prefix' => '',
'prefix_schema' => '',
],
]; Given the connections above, you can use it in the model by setting the connection property class Product extends Model
{
protected $connection = 'sales';
}
class User extends Model
{
protected $connection = 'main';
} Also, it appears that you want to use the same DB but with connection that has no prefix. This is fine but just be aware when to use the prefix. This is what we are also doing were we prefixed the tables from Laravel. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem with connecting multiple Oracle databases
Hello,
I am trying to connect two databases. Unfortunately I get the following error message:
Database connection [oracle_client_first] not configured.
or
Database connection [oracle_client_second] not configured.
Can you help me?
env. File ->
DB_CONNECTION_FIRST=oracle_client_first
DB_CONNECTION_SECOND=oracle_client_second
oracle file ->
return [
'oracle_client_first' => [
'driver' => 'oracle',
'tns' => 'XE',
'host' => '127.0.0.1',
'port' => '1521',
'database' => 'XE',
'username' => 'SYSTEM',
'password' => 'xxx',
'charset' => 'AL32UTF8',
'prefix' => 'HIS_',
'prefix_schema' => '',
],
'oracle_client_second' => [
'driver' => 'oracle',
'tns' => 'XE',
'host' => '127.0.0.1',
'port' => '1521',
'database' => 'XE',
'username' => 'SYSTEM',
'password' => 'xxx',
'charset' => 'AL32UTF8',
'prefix' => '',
'prefix_schema' => '',
],
];
Models->
...
protected $connection = 'oracle_client_first';
or
protected $connection = 'oracle_client_second';
...
Beta Was this translation helpful? Give feedback.
All reactions