How to connect PostgreSQL to web2py? - postgresql

How do I connect a postgresql to a web2py application? The web2py documetation says that I can connect it using the command db = DAL("postgres://myuser:mypassword#localhost:5432/mydb") but upon doing it, it produces an error saying RuntimeError: No driver of supported ones ('psycopg2',) is available.
I already installed psycopg2 but I don't know how to use it in the web2py app. There are not a lot of resources out there about this so I'm having a lot of trouble.

Your DAL code is correct. I think psycopg2 is not installed correctly.
Maybe you want to install psycopg2-binary.

Related

Can't connect to databases in DBeaver

I'm having problems trying to connect to databases with DBeaver. I've managed to connect to one database fine with no problems. However, any additional connections is causing issues.
I keep getting the error
SCRAM authentication is not supported by this driver. You need JDK >= 8 and pgjdbc >= 42.2.0 (not ".jre" versions)
I've tried the exact same details in pgadmin, and can get into the database just fine.
I just much prefer DBeaver as pgadmin seems to lack some really basic features like autocompletion.
I've reinstalled postgres and dbeaver multiple times, ensuring that its the latest version of each, still nothing.
Fixed the issue. It appears that DBeaver was holding on to an outdated library, which was being checked first, and therefore failing the test.
Steps to solve issue.
Download latest JDBC and move to \Program Files\DBeaver\shared_drivers
Open DBeaver and click Database -> Driver Manager
Double click on PostgreSQL
Under libraries click Add file and find the new JDBC
Delete any of the previous libraries, so it remains the only one

authentication protocol refused when using MySQLWorkbench version 6.3

There are many posts here and all over the web about getting the message:
Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)
when trying to connect a a MySQL database. In my case, it's coming from MySQLWorkbench version 6.3 newly installed on a almost as newly install Ubuntu 15.10 system.
The advice is always to update the password on the database to use the new authentication.
However, that is not my problem, and that's not what the message says. It says that the OLD authentication is being used when the database wants the NEW authentication.
This version of MySQLWorkbench has a checkbox that tells it to use the OLD authentication, which is unchecked, but, from the message, it appears to be using the OLD authentication all the time.
I can connect to the database easily from version 5.2 of MySQLWorkbench running on Mac OS X.
I tried installing an older version of MySQLWorkbench on my Ubuntu system, but there were numerous errors with the package, which is intended for an earlier version of Ubuntu.
Any ideas about how I can force MySQLWorkbench to use the NEW authentication? I tried setting:
useLegacyAuth=0
but that did nothing.
OK, got the answer. The hosting outfit (Siteground) sets up MySQL passwords to work with EITHER the legacy or the new protocol. I don't know if this is homegrown, some sort of plugin that's generally available, or a standard MySQL feature. With this option, MySQLWorkbench fails to connect and erroneously reports the problem as the server not supporting the old protocol. Probably it's just confused by the error response which its programmers didn't anticipate.
Siteground very quickly set my password to use the new authentication ONLY upon my request, and then MySQLWorkbench connected with no problem.

Installing pyodbc on redhat

I am trying to install pyodbc on Redhat. I know that for pyodbc you need the unixODBC-devel. However if I have the sql server odbc driver installed on my server do I still need unixODBC?
Are you talking about this driver?
http://www.microsoft.com/en-us/download/details.aspx?id=36437
If you're using that, it is a drop in for unixODBC, however, the installation instructions seem to require you to have unixODBC, and then perform a "drop in" installation. Too bad there isn't something in yum.

ZendServer CE - change database type?

I am using the trial version of the Zend Server edition. From all the videos/documentation supposedly you are able to change the database version from SQLITE to MySQL, but all I get when deploying an application on Zend Server is to set the Host, Database name, username and password?
Just install mysql on your system and use it. ZendServer does not care what database engine you use. When installing Zend Server it is supposed to ask if you want to install mysql (possibly you have to chose manual installation or custom or extra stuff) you might of mised that option so perhapds reinstalling is the simpler solution.
But really, you should be able to just install mysql and start using it.

Flyway: Support for older DB's

I'm currently trying to set up some simple migration scripts for our databases. I was checking flyway, which seems to be simple enough for what I need. My problem is that, for Postgres, only version 9 is supported (we're using 8.4). Is it possible to work around/fix this limitation somehow, or should I start looking for other options?
Edit: I forgot to mention that when I run something like mvn flyway:status, I get the error message:
Flyway Error: java.lang.IllegalArgumentException: Unsupported Database: PostgreSQL
I can connect to the DB via psql, and I'm using the correct jdbc driver, so when I saw the requirements page in the documentation, I assumed that the version was explicitly checked by flyway.
What limitations do you encounter? Flyway is only tested on PostgreSQL version 9.0, that's it. It's not said that older PostgreSQL versions don't work. Just give it a try.
You could also setup a PostgreSQL 9.0 installation on your testbox to see if there is any difference.