Symfony doesn't find pdo_sqlsrv driver - symfony

I have one problem with Doctrine (or with my server configuration, I don't know where is the problem) in my Symfony2 web. I have been looking for an answer since several days but I haven't found it yet.
I need to connect my symfony web to a remote Microsoft SQL database through Doctrine. For this reason, I have added the "database_driver: pdo_sqlsrv" param in app/config/parameters.yml, but when I try to execute (in my Mac) a command like:
php bin/console doctrine:database:create
or
php bin/console doctrine:generate:entities AppBundle/Entity/Product
I get the following error:
[Doctrine\DBAL\Driver\PDOException] could not find driver
[PDOException] could not find driver
I have checked the phpinfo and the driver doesn't appear (only mysql, sqlite). I don't know if it's possible to add MSSQL, because in Microsoft SQL Server Functions (PDO_SQLSRV) appears that it needs to be running on a Windows.
Is not possible to access a mssql database without Windows? (If yes, how can I do it).
Would I need a Windows hosting?
Thanks in advance.

I'm using sql server on my last project.
here is what i've done to make it work on my dev environment
install pdo-dblib
composer require leaseweb/doctrine-pdo-dblib
configure doctrine to use the driver_class from the lib above instead of refering the sql_serv driver
driver_class: Lsw\DoctrinePdoDblib\Doctrine\DBAL\Driver\PDODblib\Driver

Related

How do I connect to SQLite database with adminer 4.3.1?

HI we are using Adminer 4.3.1.
We choose system sqlite3 + localhost + location to DB file.
The error is not clear. I understood SQlite is supported. And I am directed to hardcoding functions to login. Don't I just need to use the form?
In short: how does one connect to a SQlite3 file using Admin?
Helpt appreciated ;)
I have the same issue, it does look like SQLite is broken in 4.3.1 because it is fixed in 4.3.2-dev, interestingly the login form has fewer options when SQLite is selected.
You can get the latest version by cloning the github repo and running adminer/sqlite.php

unable to connect with database

I have downloded some code of symfony from github. I have configured all the things.
I have created the database using command
php app/console doctrine:database:create
I have created the database also but when I am trying to log in or register then I am not registering when I am looking at profiler then it shows that no query has been executed. what should I do ?
Check your parameters_dev.ini file inside config and confirm whether the setting s are correct or not ? have you already created the database? can you upload some more code for details?
Check your port and try type 127.0.0.1 instead of localhost in parameters file, it's strange but it works for me.
Did you create the schema after you created the database?
php app/console doctrine:schema:create
What do the logs (app/logs/dev.log or app/logs/prod.log) say?

Symfony 2 Project Receiving [PDOException] General Error: 2050

[PDOException]
SQLSTATE[HY000]: General error: 2050
example:dbextra:install [--drop]
Database is setup properly, pdo is up and running, pdo_mysql is up and running, redis is up and running, elasticsearch is up and running...
If I look in my parameters.ini or I load the page and look under db in Symfony2 it tells me that everything is running fine. But I can't get dbextra:install to work and my app simply will not write to the database even though all the logs are saying that it IS writing to the database.
My app has a user name and password login and the ability to create new users. It correctly loads the forms and allows you to create a new user... but never actually writes that info to the database (even though it's saying it IS writing it to the database.)
Checked all the settings and all the servers are functioning normally (otherwise the app wouldn't run at all.)
The only error message I can get is that one.
Any ideas?
Someone using Ubuntu with Symfony2 will ABSOLUTELY run into this problem. So I thought I´d take a moment to explain the solution.
Symfony2 requires PDO... and it requires MySQL... but you can get pretty damned far without actually having pdo_mysql. If you just have PDO and MySQL installed... your application will probably run... but it will never write to the database.
And if you do a search for PDO_MySQL Ubuntu... you'll find a lot of outdated links to old versions of pdo_mysql that won't function properly with MySQL 5.5.
The solution is to run:
apt-get install php5-mysql
And then just restart apache and that will get rid of the error.

install pdo sqlite driver

how to install pdo sqlite drivers to enable onserver support
Assuming I understand the question, you want to know how to enable PDO SQLite access. Depending on the version of your PHP configuration, you may need to select different options, but assuming PHP 5.3.x, you should edit the php.ini to include the following libraries (for Windows - similar libs with different extension on *nix) in the extension=lib.dll (or extension=lib.so):
php_pdo.dll
php_pdo_sqlite.dll
php_sqlite.dll
This assumes they are available on your server and you can edit the PHP.ini config. If you cannot then you may have to ask your host provider to do this for you (which they may...).
SQLite Functions (PDO_SQLITE)
Introduction
PDO_SQLITE is a driver that implements the PHP Data Objects (PDO) interface to enable access to SQLite 3 databases.
http://www.php.net/manual/en/ref.pdo-sqlite.php

How to make a database service in Netbeans 6.5 to connect to SQLite databases?

I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from zentus.com and added a new driver in Nebeans services panel. Then tried to connect to my database file from Services > Databases using this URL for my database:
jdbc:sqlite:/home/farzad/netbeans/myproject/mydb.sqlite
but it fails to connect. I get this exception:
org.netbeans.modules.db.dataview.meta.DBException: Unable to Connect to database : DatabaseConnection[name='jdbc:sqlite://home/farzad/netbeans/myproject/mydb.sqlite [ on session]']
at org.netbeans.modules.db.dataview.output.SQLExecutionHelper.initialDataLoad(SQLExecutionHelper.java:103)
at org.netbeans.modules.db.dataview.output.DataView.create(DataView.java:101)
at org.netbeans.modules.db.dataview.api.DataView.create(DataView.java:71)
at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:105)
at org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:480)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
What should I do? :(
The current version of Zentus SQLiteJDBC is v053, based on SQLite 3.6.1. It will not open a 2.x SQLite database. Perhaps you can use SQLite 2.x command line tool to .dump your database, and the Sqlite3 command line tool to .load it. The use Zentus SQLiteJDBC to access the new SQLite 3.x database.
Alternatively, use a JDBC driver that supports SQLite 2 such as this one.
It's againg me...
I have made two mistakes during my first attempt. After setting CLASSPATH as a system variable (hope I didn’t broke smth else :)), putting sqlite_jni.dll to the system32 folder and correcting JDBC url I have got a success :)
I also have downloaded their SQLite ODBC wrapper. Installed it and made a connection to my SQLite2 database via ordinary and UTF8 based ODBC driver. I also used built in NetBeans JDBC-ODBC Bridge driver to be able to set up this connection.
All three connections have been created but:
ordinary ODBC driver: I see text data in a wrong encoding. All other columns are displayed correctly
UTF8 ODBC driver: I don’t see text data at all. All other columns are displayed correctly
JDBC driver: I don’t see any column at all. "Select * from my_any_table" always returns an empty single column
I have Russian based data in my database.
So...currently I have returned to sqlite command line interface :))

Resources