Search code examples
laraveloracleoci8yajra-datatable

How to know laravel connect with Oracle oci8 and select statment write


Here is my Code in laravel with Oci8. i get this result

oci8 statement resource @364

. does anyone know what is issue? how to connect and use select statement.

$users = oci_connect('LE2', 'LE2', '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.55.5)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ORCL)))');
        if (!$users) {
            dd("no coonection");

          }else{
            $ss = oci_parse($users, "SELECT * FROM v_doctor_list");
            dd($ss);
          }

Solution

  • use yajra library to connect laravel to oracle you can use this code to test connection

    if (DB::connection('your-connection-name')->getDatabaseName()) {
        echo "connected" 
    }else{
     echo "not connected" 
    }