Replies: 2 comments 1 reply
-
@Maniload I'm not using Eloquent standalone, but at first glance it looks like addConnection may accept the same values as the config file values in Laravel, since they all end up passed into the PDO connection. So just passing connection parameters in "options". Untested, so I could be wrong. Something like this... $capsule->addConnection([
'driver' => 'pgsql',
// others...,
'options' => [
'connect_timeout' => 10 // Might need PDO::ATTR_TIMEOUT
]
]); If that doesn't work. You might just build them from an array so they're more readable. Something like this... $options = [
'hostaddr' => '12.34.56.78,12.34.56.79',
'target_session_attrs' => 'read-write',
// others...
];
[
'host' => 'host1,host2;' . http_build_query($options, '=', ';')
] |
Beta Was this translation helpful? Give feedback.
-
We also tried this but it seems is disregarded for mysql at least. The connection is retried 3 times then it throws error.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello 👋,
I'm using Eloquent (standalone) to connect to a Postgres database. Unfortunately I need a few connection options that don't seem to be currently supported by the database connector (
Illuminate\Database\Connectors\PostgresConnector
).The options I need include
hostaddr
,target_session_attrs
,connect_timeout
andsslcompression
. But of course there are even more options defined here that don't seem to be supported.Right now I'm using an ugly workaround that injects the options using the
host
parameter, which looks like this:But maybe I'm just missing something and there is a better way to do this already. Otherwise it would be helpful if there was a way to pass arbitrary connection parameters.
I hope you can help me!
Beta Was this translation helpful? Give feedback.
All reactions