How to reconnect a Console? - datagrip

I am fairly new to DataGrip, and couldn't figure out how to reconnect an existing console. My Redshift connection disconnects if the connection is inactive for more than 20 minutes, and to reconnect I have to restart the console.

Now I have just tried to wait for 20 minutes and then run statements and all was ok.
Anyway, try to choose "Disconnect" from context menu of your data source and then run statements in console again (so, the console will restore "broken" connection and it might work).

Related

java.sql.SQLRecoverableException: Connection has been administratively disabled by console/admin command. Try later

When our application tries to connect Oracle database, this exception is thrown:
java.sql.SQLRecoverableException: Connection has been administratively disabled by console/admin command. Try later. java.lang.Exception: It was disabled at Tue Oct 20 23:55:14 CEST 2015
But, from Weblogic console the connection test returns OK.
Weblogic version: 12.1.3.0.0
Any explanation is welcome. Thanks
The reason the test works is because that is creating a connection and running a test query. That is not what your code is doing when it is using the data source in an ejb. The code is going through the connection pool and that is what has been marked as bad. There is no solution provided by Oracle that I have found except to: restart the server and that will re-enable the connection pool.
I suspect you have "Test connections on reserve" set because that is when this usually arises. What Weblogic does is: before it returns a connection from the pool it will run a test query, if the test query fails it waits and runs it one more time. If the query fails again it marks the connection as unhealthy. If all the connections in the pool become unhealthy it will mark the pool as disabled and gives you the error message you see: 'Connection has been administratively disabled by console/admin command. Try later.'
In regards to the 'Try Later' part of the error message, as far as I can tell Oracle is wrong about trying again later. I have never seen it recover later.
I'd like to share this article that help me out to understand better my problem:
https://www.techpaste.com/2012/09/connection-administratively-destroyed-reconnect-oracle-weblogic-server/
The “java.sql.SQLException: Connection has been administratively destroyed.” is expected:
the DB was shutdown; even if it was restarted later, the JDBC connection are pointing to DB processes
that have been destroyed.
You need to restart your WebLogic Server to recreate new JDBC connections.
All the current transactions are lost, as the database was shutdown.
High availability of your RDBMS is required to minimize this issue.
Is there any other error before that one ?
Maybe in the log you can find that connection is been closed.
You can avoid this by selecting "Test on Connection Reserve" in the datasource.

Windows 7: Scheduling automatic VPN connection with WLAN connection

There doesn't seem to be any easy way to tell Windows 7 that a network connection should allways use a VPN connection (like it is in Linux), so I've been playing around a bit with Task Scheduler to do this.
What I need is to automatically connect to a VPN when a WLAN connection is established. Why? Because if I connect to the VPN manually, every time I put the computer to sleep or hibernate it, the VPN is disconnected and I have to connect manually again. Which is easy to forget.
In Task Scheduler, I've created the following:
Triggers:
On an event -> Log: System, Source: Power-Troubleshooter, Event ID: 1
On an event -> Log: System, Source: Kernel-Power, Event ID: 42
(I found the above in a tutorial, and they seem to work.)
Action: rasdial
This works. When running the task manually, it connects to the VPN.
However, the problem is that when logging in after sleep/hibernation, the task is run immediately. Hence, it runs before the WLAN connection is established, thus failing and quitting in a couple of seconds.
So, what I need is to delay the task for a few seconds, until the WLAN connection is established. Either for a specified number of seconds, or better - wait for the WLAN connection to be established.
Is there any way of doing this, without creating a script file with a wait function? The task can be set to retry if it fails, but only with 1 minute intervals, which is much too long.
If the only solution is to create a script file for starting the VPN connection, and adding a wait function there, could someone show me an example? (I'm not good at windows scripting at all.)
I don't think there's a way to do that without scripting it. At least not that I know of (which doesn't necessarily mean very much).
If you want to script it, here's a simple .vbs script that waits before running the rasdial command:
WScript.Sleep 5000
Set objShell = "WScript.CreateObject("WScript.Shell")
objShell.Run """c:\windows\system32\rasdial.exe"" <vpn connection> <username> <password>", 1, True
Set objShell = Nothing
Then just run this script file instead of the rasdial.exe command from the Task Scheduler.

google app engine cloud sql connection never closes

I`m in the development stage of an app and I don't make many server\cloud sql calls but for some reason I have an average of 400 usage hours a month.
When I look at the cloud sql active connections dashboard I see there is always at least one active connection but in the read\write operations it's usually on 0 besides the occasional small bumps.
I create a new connection each time I make a request to the server\cloud sql and close the connection each time when I return the response.
the connection code is(I followed the guestbook tutorial\example)
Class.forName("com.mysql.jdbc.GoogleDriver");
this.dbUrl = "jdbc:google:mysql://trivia9991:triviadb?user=root";
this.dbConn = DriverManager.getConnection(dbUrl);
the closing connection code is
this.dbConn.close();
How can this keep a connection open at all time?
If the connection close code is actually running this should not be the issue. You should make sure that the connection is closed even if an exception occurs before hand.
It is also possible that a connection you made using the MySQL command line client is still open.
You can examine what connections are open by connecting using the MySQL command line client and running a SHOW PROCESSLIST; statement.

How to auto connect with Soket.io

I'm creating a webapp that support offline mode using AppCache.
When I'm online, it connect fine. If the connection is dropped and regain, it reconnect correctly.
My problem is when I'm opening my webapp when disconnected and then a connect to the internet, Socket.IO doesn't connect. It just doesn't try to connect.
I analysed a little bit the code, and it seen that it need a first valid connection in order to try to reconnect. If the first connection fail, it will permanently fail.
Is there something I miss?
So what stops you to have a global variable isConnectionStartedOnce, initialize it on the first successful connection. And on re connection event if it is initiaziled - reconnect, otherwise connect from scratch.

Putty server unexpectedly closed network connection

I'm getting this error when using Putty:
Server unexpectedly closed network connection
I think there is a problem with the network in my office because all computers at my work workplace have the same problem. How can I fix this?
If this error happens after a while that you are connected to the host, probably in your work network have some router periodically closing the connections, a workaround for this is keep your terminal busy, running something like top when you are away, but remember this creates a security breach.
Basically your connection is being closed by inactivity, if you just keep something running in your terminal, is more likely that it doesn't close the connection, I mean by something running as the terminal screen being refreshed constantly, if you run a Linux box, type the command top, that shows the box load and refreshes every 5 seconds.

Resources