我正在使用laravel 8并尝试yajra/oci 8软件包。我可以连接到数据库,但无法执行基本查询,如:
$pdo = DB::connection('oracle');
$data = $pdo->table('SD_WH_V')->first();
它总是给我:
Error Code : 1861 Error Message : ORA-01861: literal does not match format string Position : 7929 Statement : select * from (select * from "SD_WH_V") where rownum = 1 Bindings : [] (SQL: select * from (select * from "SD_WH_V") where rownum = 1)
但当我使用oci_connect & oci_parse执行此操作时,它给出了正确的结果
$s = oci_parse($conn, 'select * from (select * from "SD_WH_V") where rownum = 1');
oci_execute($s);
oci_fetch_all($s, $res)
我的oracle配置是
'oracle' => [
'driver' => 'oracle',
'tns' => '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.11X)(PORT = 15XX))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =PRXX)))',
'host' => env('DB_HOST_ORA', ''),
'port' => env('DB_PORT_ORA', '1521'),
'database' => env('DB_DATABASE_ORA', ''),
'username' => env('DB_USERNAME_ORA', ''),
'password' => env('DB_PASSWORD_ORA', ''),
'charset' => env('DB_CHARSET', 'UTF8'),
'prefix' => env('DB_PREFIX', ''),
'prefix_schema' => env('DB_SCHEMA_PREFIX', ''),
'server_version' => env('DB_SERVER_VERSION', '11g'),
'load_balance' => env('DB_LOAD_BALANCE', 'yes'),
'dynamic' => [],
'session' => []
]
我的oracle数据库可能是版本10,驱动程序/包是否存在兼容性问题?
1条答案
按热度按时间66bbxpm51#
已通过使用以下命令更改文件Oci8ServiceProvider.php上的sessionVars数组修复此问题
与Oracle数据库上的NLS配置相同
非常感谢你的帮助!