Avoiding “MySQL server has gone away” on infrequently used Python / Flask server with SQLAlchemy

I’ve had trouble with this before, and found that the way to handle it is by not keeping sessions around. The trouble is you are trying to keep a connection open for way too long. Instead, use a thread local scoped session like so either in __init__.py or in a utility package that you import … Read more

Testing an Entity Framework database connection

Are you just wanting to see if the DB connection is valid? If so take a look at the using (DatabaseContext dbContext = new DatabaseContext()) { dbContext.Database.Exists(); } http://msdn.microsoft.com/en-us/library/gg696617(v=vs.103).aspx and for checking if a server machine is up, DB server or web services server , try this: public PingReply Send( string hostNameOrAddress ) http://msdn.microsoft.com/en-us/library/7hzczzed.aspx

Where are SQL Server connection attempts logged?

You can enable connection logging. For SQL Server 2008, you can enable Login Auditing. In SQL Server Management Studio, open SQL Server Properties > Security > Login Auditing select “Both failed and successful logins”. Make sure to restart the SQL Server service. Once you’ve done that, connection attempts should be logged into SQL’s error log. … Read more

Persist Security Info Property=true and Persist Security Info Property=false

Even if you set Persist Security Info=true OR Persist Security Info=false it won’t show a difference up front. The difference is happening in the background. When Persist Security Info=False, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open … Read more

What is a good value for CONN_MAX_AGE in Django?

This value depends on the traffic of your site, the more traffic the more seconds to retain the connection, I’d recommend setting a relatively small value like 60 and tuning it accordingly to the usage pattern. Edit (2018): Like @jcyrss pointed out, this method has its quirks, for future reference I’d recommend handing out pooling … Read more

phpMyAdmin on MySQL 8.0 [duplicate]

Log in to MySQL console with root user: root@9532f0da1a2a:/# mysql -u root -pPASSWORD and change the Authentication Plugin with the password there: mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY ‘PASSWORD’; Query OK, 0 rows affected (0.08 sec) You can read more info about the Preferred Authentication Plugin on the MySQL 8.0 Reference Manual https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password … Read more

Python Database connection Close

Connections have a close method as specified in PEP-249 (Python Database API Specification v2.0): import pyodbc conn = pyodbc.connect(‘DRIVER=MySQL ODBC 5.1 driver;SERVER=localhost;DATABASE=spt;UID=who;PWD=testest’) csr = conn.cursor() csr.close() conn.close() #<— Close the connection Since the pyodbc connection and cursor are both context managers, nowadays it would be more convenient (and preferable) to write this as: import pyodbc … Read more

What is the point of “Initial Catalog” in a SQL Server connection string?

If the user name that is in the connection string has access to more then one database you have to specify the database you want the connection string to connect to. If your user has only one database available then you are correct that it doesn’t matter. But it is good practice to put this … Read more

Why can’t a Flutter application connect to the Internet when installing “app-release.apk”? But it works normally in debug mode

Open the AndroidManifest.xml file located at ./android/app/src/main and add the following line: <manifest xmlns:android=”…”> <uses-permission android:name=”android.permission.INTERNET”/> <!– Add this –> </manifest> From here: Add the android.permission.INTERNET permission if your application code needs Internet access. The standard template does not include this tag but allows Internet access during development to enable communication between Flutter tools and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)