1

Hopefully a real easy one - but have spent quite a bit of time on it.

Basically I'm going down the PDO route as we are all meant to do now.

On my dev server I've used PDO and the OBDC connection to my cache database. It's worked fine no problems moving to live and it's been quite slow. I think some of this has been down to the architecture 32bit/64bit systems.

Anyway, after playing with the drivers and then giving up I went back to the PHP script and hammered out the DSN which connects. On local again lightning -- on live really slow.

I added the SQL_CUR_USE_ODBC which I've heard good things about and both seem to be ok now.

My question is how do I do this using the pdo object?

I think it's under setCursor but don't know what to pass or anything.

my current connection string is

$conn = odbc_connect ( "DRIVER={InterSystems ODBC};SERVER=xxxxxxx;DATABASE=development;
UID=xxxxxx;PWD=xxxxxxxx;" , "" ,SQL_CUR_USE_ODBC);

the pdo one is

$pdo = new PDO("odbc:pmi");

With all the server and password information inside. So how do I use the SQL_CUR_USE_ODBC in pdo.

Just to be clear: IIS7, PHP 5.4, 64 bit Windows 2008 R2 server. My dev the same but 32bit Windows 7.

1
  • 1
    Cheers I'll try and get my formatting better next time - just not very good with it. Looks like capitals and code were my two downfalls. Ta's Richard Sep 18, 2014 at 15:34

1 Answer 1

1

I managed to fix it with the following PDO object parameters

$pdo = new PDO("DRIVER={InterSystems ODBC};SERVER=xxxxxxx;DATABASE=development;
UID=xxxxxx;PWD=xxxxxxxx;", 'user', 'pass', array(SQL_CUR_USE_ODBC));

And it works!
Also now the username and everything is in the code so if you port it to another machine you don't have to think about a new odbc connection in windows or where ever.

2
  • waves Hello from the future! I'm the guy who found this helpful! Nov 30, 2017 at 12:46
  • 1
    Thanks, nice to know I help some people and not just myself! Dec 4, 2017 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.