Connect PHP ( Mac OS ) to MsSQL Server 2008 RC2 connection string format -
i able connect mssql (remote pc) following command via terminal:
tdsver=8.0 tsql -h 192.168.1.10 -p 1433 -u derrick -p friday
i need know how translate successful string php/pdo connection string, ive tried:
$connect = new \pdo("dblib:host=192.168.1.10:1433", "derrick", "friday");
as as:
$connect = new \pdo("dblib:host=mssqlserver", "derrick", "friday");
where "mssqlserver" in config file is:
[mssqlserver] host = 192.168.1.10 port = 1433 tds version = 8.0
the error im getting php is:
sqlstate[01002] adaptive server connection failed (severity 9)
the tds log shows following:
> log.c:194:starting log file freetds 0.92.405 on 2014-04-14 > 18:25:21 debug flags 0x4fff. net.c:204:connecting 192.168.1.10 > port 1433 (tds version 5.0) net.c:270:tds_open_socket: connect(2) > returned "operation in progress" net.c:310:tds_open_socket() > succeeded util.c:159:changed query state dead idle > packet.c:133:sending packet 0000 02 00 02 00 00 00 00 00-6d 69 6e 69 > 2e 6c 6f 63 |........ mini.loc| 0010 61 6c 00 00 00 00 00 00-00 00 00 > 00 00 00 00 00 |al...... ........| 0020 00 00 00 00 00 00 0a 44-65 72 > 72 69 63 6b 00 00 |.......d errick..| 0030 00 00 00 00 00 00 00 00-00 > 00 00 00 00 00 00 00 |........ ........| 0040 00 00 00 00 00 07 46 > 72-69 64 61 79 00 00 00 00 |......fr iday....| 0050 00 00 00 00 00 00 > 00 00-00 00 00 00 00 00 00 00 |........ ........| 0060 00 00 00 00 06 > 31 38 36-34 00 00 00 00 00 00 00 |.....186 4.......| 0070 00 00 00 00 > 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 0080 00 00 00 > 04 03 01 06 0a-09 01 00 00 00 00 00 00 |........ ........| 0090 00 00 > 00 00 50 48 50 20-66 72 65 65 74 64 73 00 |....php freetds.| 00a0 00 > 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 00b0 > 00 00 0b 31 39 32 2e 31-36 38 2e 31 2e 31 30 3a |...192.1 68.1.10:| > 00c0 31 34 33 33 00 00 00 00-00 00 00 00 00 00 00 00 |1433.... > ........| 00d0 00 11 00 06 46 72 69 64-61 79 00 00 00 00 00 00 > |....frid ay......| 00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 > 00 |........ ........| 00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 > 00 00 |........ ........| 0100 00 00 00 00 00 00 00 00-00 00 00 00 00 > 00 00 00 |........ ........| 0110 00 00 00 00 00 00 00 00-00 00 00 00 > 00 00 00 00 |........ ........| 0120 00 00 00 00 00 00 00 00-00 00 00 > 00 00 00 00 00 |........ ........| 0130 00 00 00 00 00 00 00 00-00 00 > 00 00 00 00 00 00 |........ ........| 0140 00 00 00 00 00 00 00 00-00 > 00 00 00 00 00 00 00 |........ ........| 0150 00 00 00 00 00 00 00 > 00-00 00 00 00 00 00 00 00 |........ ........| 0160 00 00 00 00 00 00 > 00 00-00 00 00 00 00 00 00 00 |........ ........| 0170 00 00 00 00 00 > 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 0180 00 00 00 00 > 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 0190 00 00 00 > 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 01a0 00 00 > 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 01b0 00 > 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| 01c0 > 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........| > 01d0 00 08 05 00 00 00 44 42-2d 4c 69 62 72 61 72 79 |......db > -library| 01e0 0a 05 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli| 01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 > 00 |sh...... ........| > > packet.c:133:sending packet 0000 02 01 00 61 00 00 00 00-00 00 00 00 > 00 00 0a 00 |...a.... ........| 0010 00 00 00 00 00 00 00 00-00 00 00 > 00 00 00 00 00 |........ ........| 0020 00 00 00 00 00 00 00 00-00 00 > 00 00 00 00 00 00 |........ ........| 0030 00 00 00 00 00 00 00 00-00 > 00 00 00 01 35 31 32 |........ .....512| 0040 00 00 00 03 00 00 00 > 00-e2 16 00 01 09 00 08 0f |........ ?.......| 0050 6d 7f ff ff ff fe > 02 09-00 00 00 00 02 68 00 00 |m.????.. .....h..| 0060 00 > - |.| > > token.c:314:tds_process_login_tokens() util.c:159:changed query state > idle dead util.c:315:tdserror(0x7fec1968e950, 0x7fec196c8c60, > 20017, 0) dblib.c:7874:dbperror(0x7fec196c8830, 20017, 0) > dblib.c:7927:20017: "unexpected eof server" > dblib.c:5737:dbgetuserdata(0x7fec196c8830) dblib.c:7948:"unexpected > eof server", client returns 2 (int_cancel) > util.c:345:tdserror: client library returned tds_int_cancel(2) > util.c:368:tdserror: returning tds_int_cancel(2) token.c:323:looking > login token, got 0() token.c:108:tds_process_default_tokens() > marker 0() token.c:111:leaving tds_process_default_tokens() > connection dead login.c:459:login packet accepted > util.c:315:tdserror(0x7fec1968e950, 0x7fec196c8c60, 20002, 0) > dblib.c:7874:dbperror(0x7fec196c8830, 20002, 0) dblib.c:7927:20002: > "adaptive server connection failed" > dblib.c:5737:dbgetuserdata(0x7fec196c8830) dblib.c:7948:"adaptive > server connection failed", client returns 2 (int_cancel) > util.c:345:tdserror: client library returned tds_int_cancel(2) > util.c:368:tdserror: returning tds_int_cancel(2) > dblib.c:1439:dbclose(0x7fec196c8830) > dblib.c:253:dblib_del_connection(0x103a42d90, 0x7fec196c8c60) > mem.c:598:tds_free_all_results() dblib.c:300:dblib_release_tds_ctx(1) > dblib.c:5837:dbfreebuf(0x7fec196c8830) > dblib.c:735:dbloginfree(0x7fec196c7b90) dblib.c:1508:dbexit(void) > dblib.c:1508:dbexit(void) dblib.c:300:dblib_release_tds_ctx(1)
$servername = "ip\sqlexpress"; $connectionoptions = array("database"=>"db","uid"=>"name","pwd"=>"pass"); $conn2 = sqlsrv_connect( $servername, $connectionoptions);
Comments
Post a Comment