Closed wstaples closed 10 years ago
if I var_dump the $dsn, $username, $password variables from laravel\framwork\src\illuminate\database\connectors\connector.php (around line 40) I find that they are set with the values of "odbc:odbc:datasource", "user", "password" as though it is not using the settings from database.php. If I set them manually in connector.php everything is fine. (except it breaks connection to other databases)
thats what I use for mssql - 'odbc' => array( 'driver' => 'odbc', 'dsn' => 'Driver={SQL Server Native Client 11.0};Server=.\SQLExpress;', 'grammar' => 'SqlServerGrammar', 'username' => 'username', 'password' => 'password', 'database' => 'database', ), with my pull requests its working. a quick search over the net finds this - odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;
should be in the PDO dns,so just change it to your needs
It looks like the application I working with chooses between several database.php files at run time based on computer name. I was not modifying the correct one. There is no issue with the odbc code.
Getting the following error: SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
.
Here is a code snippet from my database.php
file.
'main' => array(
'driver' => 'odbc',
'dsn' => 'odbc:DEV',
'grammar' => 'SqlServerGrammar',
'username' => '',
'password' => '',
'database' => '',
)
I want to be able to use the ODBC driver manager dns connection method.
http://www.php.net//manual/en/ref.pdo-odbc.connection.php
Is there something I am missing as to why I am receiving this error?
yes,as I mentioned above the default code doesnt work for sql server,look at my pull requests. also your dns should look something like this - 'dsn' => 'Driver={SQL Server Native Client 11.0};Server=.\SQLExpress;',
the driver part should be based on your sql server version,the one I mentioned is for 2012
Hello,
I'm receiving the error: SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
when trying to use an eloquent model based on this driver. I'm not really sure where to begin troubleshooting. We have an installed and working odbc driver for iseries/db2. The driver is configured with UnixODBC. We are using the MySQL driver for i as well but the performance is not as good as straight db2.
Here is my model:
Here is the code I'm using to create the model:
And here is the relevant section of my database.php