How to close idle connections in PostgreSQL automatically?

For those who are interested, here is the solution I came up with, inspired from Craig Ringer’s comment: (…) use a cron job to look at when the connection was last active (see pg_stat_activity) and use pg_terminate_backend to kill old ones.(…) The chosen solution comes down like this: First, we upgrade to Postgresql 9.2. Then, … Read more

Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?

Connection timeouts (assuming a local network and several client machines) typically result from a) some kind of firewall on the way that simply eats the packets without telling the sender things like “No Route to host” b) packet loss due to wrong network configuration or line overload c) too many requests overloading the server d) … Read more

How to fix HttpException: Connection closed before full header was received

Right now this issue is opened on github https://github.com/flutter/flutter/issues/32587 Temporarily you can solve this issue by switching to physical device instead of emulator How to test android apps in a real device with Android Studio? Decision found on github (link upward) I’ve got a temporary work around, which I can use for now. The exception … Read more

Setting up connection string in ASP.NET to SQL SERVER

You can also use this, it’s simpler. The only thing you need to set is “YourDataBaseName”. <connectionStrings> <add name=”ConnStringDb1″ connectionString=”Data Source=localhost;Initial Catalog=YourDataBaseName;Integrated Security=True;” providerName=”System.Data.SqlClient” /> </connectionStrings> Where to place the connection string <?xml version=’1.0′ encoding=’utf-8′?> <configuration> <connectionStrings> <clear /> <add name=”Name” providerName=”System.Data.ProviderName” connectionString=”Valid Connection String;” /> </connectionStrings> </configuration>

How to determine total number of open/active connections in ms sql server 2005

This shows the number of connections per each DB: SELECT DB_NAME(dbid) as DBName, COUNT(dbid) as NumberOfConnections, loginame as LoginName FROM sys.sysprocesses WHERE dbid > 0 GROUP BY dbid, loginame And this gives the total: SELECT COUNT(dbid) as TotalConnections FROM sys.sysprocesses WHERE dbid > 0 If you need more detail, run: sp_who2 ‘Active’ Note: The SQL … Read more

How to grant remote access permissions to mysql server for user?

This grants root access with the same password from any machine in *.example.com: GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%.example.com’ IDENTIFIED BY ‘some_characters’ WITH GRANT OPTION; FLUSH PRIVILEGES; If name resolution is not going to work, you may also grant access by IP or subnet: GRANT ALL PRIVILEGES ON *.* TO ‘root’@’192.168.1.%’     IDENTIFIED … Read more

How to test an Internet connection with bash?

Without ping #!/bin/bash wget -q –spider http://google.com if [ $? -eq 0 ]; then echo “Online” else echo “Offline” fi -q : Silence mode –spider : don’t get, just check page availability $? : shell return code 0 : shell “All OK” code Without wget #!/bin/bash echo -e “GET http://google.com HTTP/1.0\n\n” | nc google.com 80 … Read more

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