MSSQL - Driver does not support setting attributes (SQLSTATE[IM001])
When making a connection to a MS SQL Server from Symfony2:
$con = Propel::getConnection('default');
I get the following error:
SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes
This happens when trying to set the following:
// app/config/config.yml
propel:
database:
connections:
default:
...
attributes:
ATTR_EMULATE_PREPARES: true
However, even when this is removed, the error still persists because the DependencyInjector adds in a default:
// Propel\PropelBundle\DependencyInjection\Configuration
->arrayNode('attributes')
->addDefaultsIfNotSet()
->children()
->booleanNode('ATTR_EMULATE_PREPARES')->defaultFalse()->end()
->end()
->end()
If I remove like so, it works:
->arrayNode('attributes')
->addDefaultsIfNotSet()
->end()
Question: I wonder if the adapter should be checked before adding the default attribute ('ATTR_EMULATE_PREPARES) ?
Stack Trace
in vendor/propel/propel/src/Propel/Runtime/Connection/PdoConnection.php at line 76 -
$attribute = constant($attribute);
}
return parent::setAttribute($attribute, $value);
}
adapter: mssql driver: pdo_dblib framework: symfony2 propel version: 2.0.0-dev
You can overwrite the attributes, by setting an empty array (or any other list), as this is what you want.
propel:
database:
connections:
default:
...
attributes: []
I believe I tried this already and the DependencyInjector detects that the array is empty and goes ahead and adds the children. Let me confirm.
Can confirm that setting an empty array does not help.
don't use set attribut use array in pdo from the begining