Cannot connect to oracle database

Cannot connect to oracle database

cln@telenor.dkcln@telenor.dk Posts: 2Questions: 1Answers: 0

Hi,

I'm getting following error when trying to connect to an oracle database via datatables-editor:
"error": "An error occurred while connecting to the database 'cmo'. The error reported by the server was: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

tnsping my-db-name works ok
sqlplus from CLI works ok
Simple oracle connect from simple PHP works OK

Snippet from config.php:
$sql_details = array(
"type" => "Oracle", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => "myusername", // Database user name
"pass" => "mypassword", // Database password
"host" => "my-ip", // Database host
"port" => "1521", // Database connection port (can be left empty for default)
"db" => "my-db-name" // Database name
);

Any help appreciated

/Claus

Answers

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Our config for the testing is

    $sql_details = array(
        "type" => "Oracle",     // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
        "user" => "SYSTEM",          // Database user name
        "pass" => "Pa55word123.",          // Database password
        "host" => "192.168.234.235", // Database host
        "port" => "1521",          // Database connection port (can be left empty for default)
        "db"   => "ORCLCDB",          // Database name
        "dsn"  => "",          // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
        "pdoAttr" => array()   // PHP PDO attributes array. See the PHP documentation for all options
    );
    

    The only difference being the pdoAttr and dsn options - could you try setting those the same and see if that helps, please?

    Colin

  • cln@telenor.dkcln@telenor.dk Posts: 2Questions: 1Answers: 0
    edited December 2019

    I think I sorted it out.

    In
    datatables\php\Database\Driver\Oracle\Query.php

    //$conn = @oci_connect($user, $pass, $host.$port.'/'.$db, 'utf8');
    $conn = @oci_connect($user,$pass,$db);

    Something odd with the connector.
    Modified it a bit and now I'm connected.

This discussion has been closed.