You can translate the question and the replies:

ODBC binding parameters

I'm connecting true the ODBC driver form PHP to the denodo database. I'm using pdo and want to make use of binding parameters in de code. e.q.: This works: $denodo = new DenodoDatabase(); $sql = "SELECT * from orders where ordernumber = 20753852 limit 10"; $denodo->query($sql, true); $array = $denodo->resultset(); This is NOT working $denodo = new DenodoDatabase(); $sql = "SELECT * from orders where ordernumber =? limit 10"; $denodo->query($sql, true); denodo->bind('1' ,'20753852'); $array = $denodo->resultset(); This is also NOT working $denodo = new DenodoDatabase(); $sql = "SELECT * from orders where ordernumber = :ordernumber limit 10"; $denodo->query($sql, true); denodo->bind(':ordernumber','20753852'); $array = $denodo->resultset(); How can this be made working, it seems that the supplied ODBC driver noet supports it. kind regards, Aren
15-12-2019 10:13:32 -0500

3 Answers

Hi, I was able to connect and retrieve results from Virtual DataPort using PHP Data Objects through an ODBC connection. In my code, I first used [prepare()]( to prepare the SQL statement for execution, and instead of using bind(), I used the following PDOStatement methods: * [bindValue()]( * [bindParam()]( If you run into any errors, you can enable the "vdp-requests.log" file by executing the [LOGCONTROLLER]( stored procedure in VQL Shell: `CALL LOGCONTROLLER('com.denodo.vdp.requests', 'INFO');` After configuring the logging level, you can check the "vdp-requests.log" located in the "<DENODO_HOME>/logs/vdp" folder to view all of the requests sent to Virtual DataPort from PHP. Hope this helps!
Denodo Team
16-12-2019 15:50:50 -0500
Hi, Thanks for your answer. I have no access to the remote database, so I can't switch one logging i guess. I also use bindValue and/or bindParam in my PDO class but no go )-: If I split is out in the basic steps the code is: try { $dbh = new PDO("odbc:myODBC","user","password"); //$sql = "SELECT ordernumber from orders limit 11"; <- THIS WORKS $sql = "SELECT ordernumber from orders where ordernumber = :ordernumber limit 11"; <- THIS NOT, No results $stmt = $dbh->prepare($sql); $order = 21519019; <- This ordernumber exists $stmt->bindParam(":ordernumber", $order); if($stmt->execute()) { $result = $stmt->fetchAll(PDO::FETCH_ASSOC); echo "<pre>Result"; print_r($result); } /*** close the database connection ***/ $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); } So, any help is welcome.
17-12-2019 05:44:40 -0500
Hi, I used PHP 7 to execute the code you provided and was able to return results from my table in the form of an indexed array since the parameter [PDO::FETCH_ASSOC]( was used. What I would do is reach out to your Denodo Platform administrator about changing the logging level of "com.denodo.vdp.requests" to "INFO" as mentioned earlier. Then, execute your PHP code again so that you can debug this issue. Ensure that the logging level is changed back to "ERROR" after you are done inspecting the logs. Hope this helps!
Denodo Team
23-12-2019 17:54:49 -0500
You must sign in to add an answer. If you do not have an account, you can register here