mrkeck Sharing the Love

28Dec/110

mySQL ODBC Error

"The specified DSN contains an architecture mismatch between the Driver and Application"

I'm using WAMP on 64-bit Windows 7. Turns out when you go to ODBC connections through control panel that brings up the 64-bit connections. I had to go to c:\windows\sysWOW64\odbcad32.exe to setup the connection for 32-bit on a 64-bit OS.
Works great!

http://msdn.microsoft.com/en-us/library/windows/desktop/ms712362(v=vs.85).aspx

To manage a data source that connects to a 32-bit driver under 64-bit platform, use c:\windows\sysWOW64\odbcad32.exe. To manage a data source that connects to a 64-bit driver, use c:\windows\system32\odbcad32.exe. In Administrative Tools on a 64-bit Windows 8 operating system, there are icons for both the 32-bit and 64-bit ODBC Data Source Administrator dialog box.

Filed under: msaccess, mySQL, PDO, wamp No Comments
6May/110

PDO – COUNT field incorrect: 0

$stmt = $db->prepare("SELECT field FROM table where field=:batchNum and scan_time>CAST(FLOOR( CAST( GETDATE() AS FLOAT ) )AS DATETIME)");
 
$stmt->execute();

I forgot to bind something to :batchNum.

The error means that the number of expected bound variables does not match the number bound

Tagged as: , No Comments
6May/110

SQLSTATE[HY010]: Function sequence error: 0

PHP PDO MSSQL ODBC.

If you have MS SQL datetime field using odbc and try to use parameterized inserts you get a sql sequence error.

I changed the field type to varchar and worked fine.

Bug Report

Tagged as: , , , , No Comments
5May/110

PDO MSSQL bound param error

Everytime I use a bound parameter I get the error:"SQLSTATE[22001]: String data, right truncated: 0".
I am using WAMP Server 2.1 64bit on Windows 7 Pro 64bit and Ultimate 64bit. I am using an pdo_odbc to access SQL Server 2000. The weird part is it works in a different environment on Windows XP 32bit and a different SQL Server 2000.

$db = new PDO("odbc:".$hostname, $username, $password);
	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
	$stmt = $db->prepare("SELECT someField FROM someTable where 'matt'=:bob");
	$stmt->execute(array(":bob"=>'matt'));
	$result=$stmt->fetchAll(PDO::FETCH_ASSOC);
	/*
	Returns->
	Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[22001]: String data, right truncated: 0 [Microsoft][ODBC SQL Server Driver]String data, right truncation (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254) in C:\wamp\www\dbTest.php on line 5
	*/

I also tried bindParam and bindValue, no luck

UPDATE!!!
Now Works! I replaced WAMP Server 64bit with WAMP Server 32bit and everything worked.