freetds

pdo-odbc doesn't work whit bind values, nvarchar and text are incompatible in the equal to operator

你。 提交于 2019-12-01 18:33:29
问题 There is a column url(nvarchar(200), not null) <?php // $pdo = new PDO('odbc:mssql', 'xxx', 'yyy'); $pdo->setAttribute(PDO::ATTR_PERSISTENT, false); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); // plain sql query: WORKS FINE! $sth = $pdo->prepare("SELECT COUNT(*) FROM pagina WHERE url = '/webito'"); $sth->execute(); // using bindValue: ERROR! $sth = $pdo->prepare("SELECT COUNT(*) FROM pagina WHERE url = :unique_value"); $sth->execute(array('unique_value' => '/webito'));

pdo-odbc doesn't work whit bind values, nvarchar and text are incompatible in the equal to operator

ぐ巨炮叔叔 提交于 2019-12-01 18:03:16
There is a column url(nvarchar(200), not null) <?php // $pdo = new PDO('odbc:mssql', 'xxx', 'yyy'); $pdo->setAttribute(PDO::ATTR_PERSISTENT, false); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); // plain sql query: WORKS FINE! $sth = $pdo->prepare("SELECT COUNT(*) FROM pagina WHERE url = '/webito'"); $sth->execute(); // using bindValue: ERROR! $sth = $pdo->prepare("SELECT COUNT(*) FROM pagina WHERE url = :unique_value"); $sth->execute(array('unique_value' => '/webito')); Returning error: Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 402

Using typed bound parameters with PHP PDO-ODBC, unixODBC and FreeTDS

馋奶兔 提交于 2019-12-01 17:16:46
I'm using the following setup to access a MS-SQL database from a PHP application RedHat Enterprise Linux 5 PHP 5.2.14 with PDO and PDO_ODBC unixODBC 2.2.11 FreeTDS 0.82.1.dev.20100810 Unparametrized queries work fine. The only issue is being forced to close cursor on single result statements (with PDOStatment::closeCursor) to avoid "0 [FreeTDS][SQL Server] Invalid cursor state (SQLSTATE=24000)" errors. But I'm having a major issue with typed bound parameter. When using code like this: $stmt = $PDO->prepare('INSERT INTO table (column1, column2) VALUES (:foo, :bar'); $stmt->bindValue(':foo', 21,

FreeTDS: How to set charset of parameters running stored procedure

五迷三道 提交于 2019-12-01 14:32:28
I have a C program connecting to a MSSQL database through FreeTDS . I'm trying to execute a stored procedure with a varchar parameter set to something like "Saída Liberada", but it's being stored with strange characters in MS SQL, as the screenshot above: Here is my freetds.conf: # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ # # This file is installed by FreeTDS if no file by the same # name is found in the installation directory. # # For information about the layout of this file and its settings, # see the freetds.conf manpage "man freetds.conf". # Global settings are

Pyodbc can't find FreeTDS driver

荒凉一梦 提交于 2019-12-01 12:03:39
问题 I am on a Centos 7 Linux machine trying to connect to an SQL database through pyodbc. I learned that you need to setup the DSN and you do that by installing the freetds driver and doing something like: import pyodbc cnxn = pyodbc.connect('DRIVER={FreeTDS};SERVER=example;DATABASE=TEST;') Unfortunately when I do that I get an error saying the driver FreeTDS can't be found. I have ran: $ ./configure $ make $ make install It seemed to have installed it but I get the same error. Can someone please

Django <-> SQL Server 2005, text encoding problem

痞子三分冷 提交于 2019-12-01 05:38:21
I'm trying to store Django data on MS SQL Server 2005 using: http://code.google.com/p/django-pyodbc/ (pyodbc + FreeTDS) As long as I'm storing string consist of ASCII characters everything is ok. When I'm using unicode (ex. '\xc5\x82'), django throws ProgrammingError on: ProgrammingError at /admin/cli/punktrejestracji/add/ ('42000', '[42000] [FreeTDS][SQL Server]The incoming tabular data stream (TDS) protocol stream is incorrect. The stream ended unexpectedly. (4002) (SQLExecDirectW)') last element of trace is: params ('\xc5\x82',) self <django.db.backends.sql_server.pyodbc.base.CursorWrapper

pdo dblib on centos 6.x

泪湿孤枕 提交于 2019-11-30 17:56:44
问题 I am trying to install dblib on CentOS release 6.5 (Final) 64bit. centos 6 does not have freetds so I had to get freetds from elsewhere. freetds-devel-0.91-2.1.x86_64.rpm . using pecl to download and instal PDO DBLIB but i get stuck at make. the error i receive is as follows. [root@rajesh PDO_DBLIB-1.0]# make /bin/sh /root/php/PDO_DBLIB-1.0/libtool --mode=compile cc -I/usr/include/php/ext -DPDO_DBLIB_FLAVOUR=\"freetds\" -I. -I/root/php/PDO_DBLIB-1.0 -DPHP_ATOM_INC -I/root/php/PDO_DBLIB-1.0

PHP MS SQL Unix Driver - Microsoft or FreeTDS

好久不见. 提交于 2019-11-30 08:47:52
问题 I am running a LAMP server but now need to connect to MS SQL (client request). I have heard Microsoft has a driver, but can't verify if Does anyone know if the Microsoft driver is available for Unix? If not, should I just stick with FreeTDS? This appears to be recommended by PHP, however install documentation seems lacking. Any direction on either would be greatly appreciated. Sorry for the general question, I am not familiar with setting up PHP drivers. UPDATE Just for some back story, I am

在linux下连接MS SQL Server

ⅰ亾dé卋堺 提交于 2019-11-30 08:30:30
在工作中需要在Linux服务器上访问MS SQL Server数据库,我马上就想到了适用ODBC接口进行实现,毕竟它的移植性更好。 首先需要选一种支持MS SQL Server的ODBC驱动,商业的不能考虑,只能考虑开源的,于是,FreeTDS进入了视野,从官网(http://www.freetds.org/)上下载了它的0.91版本的包,在安装它之前需要安装libiconv,这个库用于进行编码转换。 开始安装! 1,从unixODBC官网( www.unixodbc.org )下载2.3.2版本 ./configure --enable-gui=no ; make ; sudo make install 2,安装libiconv,./configure ; make ; sudo make install 3,安装freetds,./configure --with-tdsver=7.0 --with-unixodbc=/usr/local --with-libiconv-prefix=/usr/local --enable-msdblib   说明,with-tdsver用于指定TDS协议版本,7.0就能支持目前新版本的MS SQL Server,with-unixodbc用于指定 unixODBC的安装路径前缀。 开始配置! 在/usr/local

php dblib, Error: SQLSTATE[HY000] Unknown host machine name (severity 2)

隐身守侯 提交于 2019-11-30 04:37:17
问题 I am using mac computer OSX 10.9. Freetds and unixODBC are already installed on my computer and added as extension to php , trying to connect to a remote MSSQL server. Below is my connection testing: <?php $dbh = new PDO('dblib:host=Hostname ;dbname=Dbname', 'user', 'pw'); if (!$dbh) { die('Something went wrong while connecting to MSSQL'); } ?> The error logs file show : [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] Unknown host