I have a laravel 5.2 instance configured to run against MS SQL Server. I have downloaded from microsoft the drivers and the connection runs perfect DB::table('usuarios')->select('*')->get(); returns:
[{"id":"5","username":"jtd","password":"$2y$10$t8RXYy\/afaEuIpE8GIk2bOvbHsQoj0fhGPxmo\/3UqJABKVA4I4pHC","email":""}]
But when I try to php artisan migrate i get the:
[PDOException]
could not find driver
Why this is happening?
Stack trace:
c:\wamp\www\presence\webapp>php artisan migrate --verbose
[PDOException]
could not find driver
Exception trace:
() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Datab
ase\Connectors\Connector.php:55
PDO->__construct() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\
Illuminate\Database\Connectors\Connector.php:55
Illuminate\Database\Connectors\Connector->createConnection() at C:\wamp\www\pre
sence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServ
erConnector.php:32
Illuminate\Database\Connectors\SqlServerConnector->connect() at C:\wamp\www\pre
sence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connect
ionFactory.php:61
Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connector
s\{closure}() at n/a:n/a
call_user_func() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Il
luminate\Database\Connection.php:924
Illuminate\Database\Connection->getPdo() at C:\wamp\www\presence\webapp\vendor\
laravel\framework\src\Illuminate\Database\Connection.php:792
Illuminate\Database\Connection->reconnectIfMissingConnection() at C:\wamp\www\p
resence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:6
77
Illuminate\Database\Connection->run() at C:\wamp\www\presence\webapp\vendor\lar
avel\framework\src\Illuminate\Database\Connection.php:349
Illuminate\Database\Connection->select() at C:\wamp\www\presence\webapp\vendor\
laravel\framework\src\Illuminate\Database\Schema\Builder.php:55
Illuminate\Database\Schema\Builder->hasTable() at C:\wamp\www\presence\webapp\v
endor\laravel\framework\src\Illuminate\Database\Migrations\DatabaseMigrationRepo
sitory.php:141
Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Database\
Migrations\Migrator.php:404
Illuminate\Database\Migrations\Migrator->repositoryExists() at C:\wamp\www\pres
ence\webapp\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\
MigrateCommand.php:103
Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase() at C:\
wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Database\Consol
e\Migrations\MigrateCommand.php:58
Illuminate\Database\Console\Migrations\MigrateCommand->fire() at n/a:n/a
call_user_func_array() at C:\wamp\www\presence\webapp\vendor\laravel\framework\
src\Illuminate\Container\Container.php:507
Illuminate\Container\Container->call() at C:\wamp\www\presence\webapp\vendor\la
ravel\framework\src\Illuminate\Console\Command.php:169
Illuminate\Console\Command->execute() at C:\wamp\www\presence\webapp\vendor\sym
fony\console\Command\Command.php:256
Symfony\Component\Console\Command\Command->run() at C:\wamp\www\presence\webapp
\vendor\laravel\framework\src\Illuminate\Console\Command.php:155
Illuminate\Console\Command->run() at C:\wamp\www\presence\webapp\vendor\symfony
\console\Application.php:794
Symfony\Component\Console\Application->doRunCommand() at C:\wamp\www\presence\w
ebapp\vendor\symfony\console\Application.php:186
Symfony\Component\Console\Application->doRun() at C:\wamp\www\presence\webapp\v
endor\symfony\console\Application.php:117
Symfony\Component\Console\Application->run() at C:\wamp\www\presence\webapp\ven
dor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at C:\wamp\www\presence\webapp\a
rtisan:36
I found a solution. I post it for everyone. I use WAMP stack (PHP, Apache and MySQL). The fact is that wamp uses the 5.5.12 version for terminal CLI, so I have to install SQL Server PDO Extensions on the version I am using and (besides this) on the 5.5.12 version (I have several PHP versions installed). Can provide more information if needed.
Related
I have presto and apache superset hosted at GCP Cloud.
Presto server hosted at http://14.22.122.12:8088/ui/
But when i try to connect Presto to Superset it's giving me this error
Could not load database driver: presto
Already installed the presto driver using pip install pyhive.
Not sure what's wrong here ? My SQLAlchemyURL presto://14.22.122.12:8088/catalog_name
This error usually appears when the driver isn't available (so the connection string format isn't recognized).
I would confirm that the pip install happened correctly. If you're running everything within docker, make sure you rebuilt properly. You can enter the docker cli, fire up a Python shell, and try to import the presto driver (you can also try pip freeze in the docker cli).
I have gone through every possible solution on the internet, but I'm unable to make pyobdc get the drivers on heroku.
The steps I have used to create the app are as follows:
heroku create
heroku config:set FLASK_CONFIG=heroku
heroku buildpacks:add heroku/python
heroku buildpacks:add --index 1 heroku-community/apt
git push heroku master
I tried even with odbc buildpack but still no luck:
heroku buildpacks:add https://github.com/iFix/heroku-buildpack-odbc.git
After going through microsoft website, I trimmed down my Aptfile to instuct heroku to install the following packages:
# install msodbcsql17
https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.4.2.1-1_amd64.deb
# install mssql-tools
https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/mssql-tools/mssql-tools_17.4.1.1-1_amd64.deb
# install unixodbc-dev
unixodbc-dev
This makes pyodbc installation go without error. But when I run pyodbc.drivers(), it returns nothing. The same command on Ubuntu 16.04 returns "ODBC Driver 17 for SQL Server"
The source code for the project is at : https://github.com/IamVNIE/odbcTestHeroku
The hosted app is at : https://pyodbctest.herokuapp.com/
Can someone please provide some pointers to make this work.
I have solved this issue by precompiling ODBC Driver 17 for SQL Server on a machine running Ubuntu 18.04 and copying the libmsodbcsql-17.5.so.2.1 and msodbcsqlr17.rll files into appropriate directories via a Heroku buildpack. This is ODBC Driver 17.5 for SQL Server and I likely won't be compiling other versions of this driver, but I imagine the concept remains the same.
The Heroku buildpack and its requirements can be found here https://github.com/matt-bertoncello/python-pyodbc-buildpack.git
Previous answer worked for me until I had to switch to heroku stack 22. After that I started getting the following error:
pyodbc.OperationalError: ('08001', '[08001] [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)')
To solve this issue I switched to another library python pymssql, that handles connections to Microsoft SQL server in azure.
here is a simple example
conn = pymssql.connect(server=xxx,\
user=yyy, \
password=zzz, \
database=xxx)
cursor = conn.cursor(as_dict=True)
cursor.execute(query)
rows = cursor.fetchall()
cursor.close()
conn.close()
I tried to make a backup with Postgres 11.1 in pgAdmin4, but it failed.
pgadmin displayed a window with
Status: Failed (exit code: 1).
pg_dump:server version: 11.1; pg_dump: 10.5
pg_dump: aborting because of server mismatch
I don't really understand it. Does pgadmin4 not know that I am using 11.1 and not 10.5?
PROBLEM SOLVED - IN MY CASE.
Go to
pgadmin < Preferences < Path < Binary Path
The PostgreSQL Binary Path was set automatically to $DIR/../runtime
I changed the Path to my installed PostgreSQL Version C:\Program Files\PostgreSQL\11\bin
Your pgAdmin is using PostgresSQL client v10, but your server is v11.
Since v10 cannot know how to correctly dump a v11 database, it refuses to try.
Use a more recent version of pgAdmin!
First things first, I read and tried stuff I found online even from this website, but can't get it to work.
I have an SQL SERVER 2014 running on Windows Server 2012, there I have a WAMP 64 bits running Apache on PHP 7.1.6 and need to connect to the Database, apparently the extension is not loaded because I'm getting the undefined function error.
$conn = sqlsrv_connect( $APIDBSERVER, $connection);
What I've done so far:
Installed Microsoft® ODBC Driver 11 for SQL Server
Downloaded PHP SQL Driver 4.0 and moved php_sqlsrv_7_nts_x64.dll to /ext
Added them to php.ini:
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_sqlsrv_7_nts_x64.dll
Apparently the PDO also needs php_pdo.dll which WAMP doesn't have and I haven't found where to download it from, so I'm using the standard non-PDO approach
Recently even tried enabling odbc extensions which were disabled:
extension=php_odbc.dll
extension=php_pdo_odbc.dll
I access the php.ini through the WAMP menu so I know I'm editing the right one, restarted the server several times trying different things but I've run out of ideas.
Can you please help me?
EDIT:
PHP error log indicates the modules couldn't be found, but if I check that path they're right there, copy&pasted filenames into php.ini.
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp64/bin/php/php7.1.6/ext/php_pdo_sqlsrv_7_nts_x64.dll' - The
specified module could not be found. in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp64/bin/php/php7.1.6/ext/php_sqlsrv_7_nts_x64.dll' - The
specified module could not be found. in Unknown on line 0
EDIT 2:
Tried downgrading to 7.0.20 and get the same error, so the php.ini is fine, it just won't load them for a reason, will try to download ODBC 13.1 maybe?
Each PHP version might require a different version of the Microsoft PHP Drivers for SQL Server.
The link below shows compatibility between PHP and MS SQLSRV versions:
https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver15.
Because of the way WAMPServer is configures, NTS extensions do not run.
So change your process just a little and use the Thread safe dll's instead.
I tried trying to install mongodb and php extension on my server with Ubuntu 14.04 and plesk 12.5 but without success of php extension. Anyone can help me with a simple tutorial on how to install mongodb driver and Mongo db php extension on my dedicated server?
Thanks
You can look on official documentation
DigitalOcean provides a detailed recipe: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
PHP MongoDB extension: installation from PECL
Forum AskUbuntu
Here you can see how you're installing multiple versions of PHP and switching them in Plesk.
Mind that you install every PHP version independently with its own extensions.
In your case you need to add MongoDB extension to some (or all) PHP versions you work with.