我得到以下错误 Yajra/Pdo/Oci8/Exceptions/Oci8Exception ORA-12505: TNS:listener当前不知道连接描述符中给出的SID。
我想要的是能够连接到Laravel 5.8.38到Oracle(远程), 我不知道如何使用以下方法进行设置 服务名称
'connections' => [
'oracle' => [
'driver' => 'oracle',
'host' => '192.168.0.190',
'port' => '1521',
'database' => 'BDDESARR',
'service_name' => '???',
'username' => 'PAT_GUZ',
'password' => 'ujUYjjdk',
'charset' => '',
'prefix' => '',
],
安装雅居乐的步骤如下: 1. https:/github.comyajralaravel-oci8tree5.8。
终端输出
PS C:\wamp64\www\desarrollo\php\laravel\miproyect> composer require yajra/laravel-oci8:"5.8.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Writing lock file
Generating optimized autoload files
文件 配置数据库.php
'default' => env('DB_CONNECTION', 'oracle'),
'connections' => [
'oracle' => [
'driver' => 'oracle',
'host' => '192.168.0.190',
'port' => '1521',
'database' => 'BDDESARR',
'service_name' => '???',
'username' => 'PAT_GUZ',
'password' => 'ujUYjjdk',
'charset' => '',
'prefix' => '',
],
补充信息,我做了以下代码,并成功运行
<?php
$conn = oci_connect('PAT_GUZ', 'ujUYjjdk', '192.168.0.190/BDDESARR');
if (!$conn) {
$e = oci_error();
var_dump($e);
}
$stid = oci_parse($conn, 'SELECT * FROM MY_TABLE');
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
Laravel 5.8.38
PHP 7.3.12
甲骨文公司。Oracle数据库11g企业版11.2.0.4.0版本-64位生产版。
Windows 10 64位
Wamp64
我对Laravel, Yajra和你提到的其他东西一无所知, 但是这个:
'database' => 'BDDESARR',
'service_name' => '???',
但这个... 错的 然后 可疑. SQL开发者连接建议 Service name = 'bddesarr'
. 我不知道 "数据库 "应该是什么。也许是SID,因为Oracle抱怨SID不对。