2

I heard about oledb and odbc, and I know both are database programming interfaces. I am trying to establish an oledb connection with the php script.

I have mysql server 2012 running on my computer. I know how to create an odbc connection with pdo in php like

PDO::OLEDB_ATTR_USE_ENCRYPTION,PDO::OLEDB_ATTR_USE_CONNECTION_POOLING etc.

But I need to know where can I execute this php script with oledb connection. Do we want to download any seperate oledb driver for using it on sql server?

peterh
  • 11,875
  • 18
  • 85
  • 108
  • oledb is drivers on the client for different communication methods with the server(that shouldn't need anything else installed). It's pretty old, and I'd recommend avoiding it because there doesn't appear to be an easy way to check what methods are supported in which drivers, and you might not get an error message on failure(IE num_rows on SQLite returns -1, SQL Server always returns 0, and MySQL will return a valid count, SQLite supports rewinding to a small degree, SQL Server doesn't, and MySQL does, but only if you cache the resultset first). – scragar Jul 04 '14 at 11:48
  • @scragar am not going to do it then ..am here for just information ..if i need to use oledb with php on mysql server ..do i need to download any special extensions for oledb on sql server ? – user3805325 Jul 04 '14 at 11:50
  • @scragar can you please answer if you know – user3805325 Jul 04 '14 at 13:33
  • The driver would only ever need to be installed on the client(the PHP server, not the database server). If you're putting the database on the same machine as the client then yes, it will need the driver installing. I think the MySQL driver for it comes built in, but I can't be sure, you're probably better off testing it to make sure. – scragar Jul 04 '14 at 13:38
  • @scragar i have another question too is sql server 2008,2010,2012 only used with windows server os only ? – user3805325 Jul 04 '14 at 13:43
  • Yes, Microsoft SQL Server is windows only. – scragar Jul 04 '14 at 13:54
  • @scragar can you tell me some hosts which uses iis web hosting ?? – user3805325 Jul 04 '14 at 13:56
  • No idea, I'm personally not even remotely interested in windows hosting, I've always used Linux. Sorry I can't help with that. – scragar Jul 04 '14 at 13:59
  • @scragar am sorry i have to ask one more thing ..is odbc and oledb do the same function on sql server ? – user3805325 Jul 04 '14 at 14:20
  • http://stackoverflow.com/questions/103167/what-is-the-difference-between-ole-db-and-odbc-data-sources – sridesmet Jul 04 '14 at 14:30
  • Basically, oledb can do everything odbc can, but odbc can't do everything oledb can. – sridesmet Jul 04 '14 at 14:32
  • @Gudgip but both are database apis ....right ?? – user3805325 Jul 04 '14 at 14:45
  • Both are indeed interfaces for SQL-based datasources. – sridesmet Jul 04 '14 at 14:47
  • @Gudgip both are used on sql server right ?? – user3805325 Jul 04 '14 at 14:50
  • Both are usable for sql server, yes. – sridesmet Jul 04 '14 at 14:52
  • @Gudgip .if you know please tell any web hosting provider which uses iis server please tell me – user3805325 Jul 04 '14 at 15:29

1 Answers1

0

Your server needs the drivers, which are downloadable (google for the drivers). PHP comes with the pdo-dll's, you just need to enable them in your php.ini file, e.g.: extension=php_pdo_odbc.dll

For more information: http://php.net/manual/en/pdo.installation.php

And what is the difference between OLE DB and ODBC data sources?

Community
  • 1
  • 1
sridesmet
  • 875
  • 9
  • 19
  • @gudgrip .suppose am using windows server 2012 and i have installed sql server 2012 ..suppose i want to make a dabase connection with php with odbc ..what i need is only to change the php.ini file ? – user3805325 Jul 04 '14 at 14:54
  • Download the driver (ole db or odbc) and install it on your sql server (they probably come pre-installed though..), then change your php.ini file. – sridesmet Jul 04 '14 at 14:55
  • ..will it work fine if i download the driver and use database connection with php with odbc connection..??.. – user3805325 Jul 04 '14 at 14:59
  • i think i need to download an extension for php for using it on sql server – user3805325 Jul 04 '14 at 14:59
  • You might have to download the extension for php, but imo I think you just have to enable it in php.ini. view the url in the answer for more information – sridesmet Jul 04 '14 at 15:01
  • thanks ..asm new to windows server actually ..do you know any good iis hosting provider ? – user3805325 Jul 04 '14 at 15:03
  • ..if you know please tell any web hosting provider which uses iis server please tell me – user3805325 Jul 04 '14 at 15:28
  • You sbould ask this in chat as it's off topic ;) – sridesmet Jul 04 '14 at 15:31
  • okay ...i have seen an sql server driver for php ..http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-the-sql-server-driver-for-php – user3805325 Jul 04 '14 at 15:38