How do you change your active database connection in SQL Workbench/J? - sql-workbench-j

Is it possible to change your active/default database connection in SQL Workbench/J while still under a single connection profile? There are times I am connected to a database server with multiple databases and I would like to switch my active database without having to use a USE statement, specify the full 3 part naming convention, or switch connection profiles entirely. In SSMS, there is a simple drop-down menu to easily switch between different databases. Just wondering if there is something similar in SQL Workbench/J that I'm just missing.

There is an experimental feature to enable a dropdown with the available databses in the main window.
If you run
WbSetDbConfig gui.enable.dbswitcher=true;
in a SQL editor tab when connected to a SQL Server database, then you should have a dropdown to switch the current database after restarting SQL Workbench/J.
It will essentially issue a USE in the background for the current connection when using SQL Server.

Related

Copying remote Firebird table to local database

I have a remote Firebird 3.0 server with a database. In this database, there is a big table. The client very often queries this table during their work. There are too many clients and bad internet connection, so the work with this table is terrible. I made a local copy of this table via IBExpert into a temporary database, which is distributed with client application.
But now there is a need in a change of some values in this table (add new values and edit some olds). So I need some kind of synchronization - copying of remote modified table to client's local database.
The client application was made by use of Delphi Berlin 10.1. So the synchronization should be done by Delphi code.
Can you give me an idea, how it will be correctly to synchronize such a big table, please?
You could fire POST_EVENT on master database (for insert, update, delete (triggers)) to notify client applications that there are changes.
Then your client would need to fire procedure (on local DB) to do a sync. This could be done by EXECUTE STATEMENT ON EXTERNAL
FOR EXECUTE STATEMENT ('SELECT ... WHERE CURRENT_TIMESTAMP >= tablename.modifiedon')
ON EXTERNAL 'SERVER/PORT:DBPATH'
You should include date of insert/modified/delete in master DB.

SQL Server connection established during design, but not during runtime

I have created an Amazon RDS DB instance. I can connect to it and perform operations with SSMS. I can also bind to it using Entity Framework DB-first and generate my model. However, when I run my app, using the same connection string that was generated in the data access project, I get a "the network path was not found" error while trying to establish a connection to the DB.
Let me be clear: the db exists, the right ports are open, and the connection string is correct. I am the only one connecting to the database and the status is "available".
So what's going on? Has anyone experienced something like this?
Let me also further mention that I have already checked the usual things like internet connectivity, firewall rules, state of the database, etc.
well it started working all of a sudden. So I guess this problem will only pop up again in production or something.

Connection to SQL Workbench/J gets disconnected frequently

The connection to SQL Workbench/J gets disconnected very frequently. Where can I change the settings so that it does not lose the connections for atleast an hour.
Thanks
This works for me with using PostgreSQL...
Go to Connection Window
Select the connection you want to keep alive
Click the "Connect scripts" button
Write "Select 1" in the third box titled "Statement to keep connection alive"
Write "1m" in fourth box titled "Idle time"
SQL Workbench/J (screenshot)
What OS are you using and what type of database are you connecting to?
I had the same issue using Windows connecting to a Redshift database. I followed the instructions on Amazon doing the following:
Edit (or otherwise create if not already existing in my case) the values for the following registry settings under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters:
KeepAliveTime: 30000
KeepAliveInterval: 1000
TcpMaxDataRetransmissions: 10
Reference here: http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-firewall-guidance.html

How to refresh query on client when server has update whithout disconnected and reconnect

I developed an Client/Server data base application, using Firebird IBdatabase, IBquery. I need to know how to refresh the data on the server AND client when one of them has update/insert query. The reason being that when I run a query on the client, after I inserted records into a table, the new records do not reflect in the queries. Until i disconnected and reconnect again
I'm using a Firebird DB with InterBase VCL, developing in Delphi XE2
You don't have to disconnect the connection, but you will have to refresh (or close and reopen) the IBQuery. This is the case for most databases.
If you do not want this, you will have to send a notification from the database to all clients. I don't know if this would be doable from FireBird, but it is not common at all for databases to do this.
The transaction type for your select query is probably snapshot. You can either start a new snapshot transaction each time you want to refresh, or use transaction type read committed.

Connecting directly to Database in Rails (Heroku?)

I am currently writing RoR applications and deploying using Heroku.
Is there any way to connect directly to the DB using a connection string?
I guess what I am asking here is can I connect directly to the DB, is there a connection string, how can I get the connection string, etc. I want to be able to perform querys on the DB outside of the terminal I am developing. My current solution is using
heroku db:pull 'anotherPOSTGRESQLdatabasesCONNECTIONstring'
and then performing queries on that database, but this is not a valid solution, because I am developing this application for users who are not code savvy, and they should be able to perform queries on the database without me or them using the terminal.
I think what you might be asking is available here: https://postgres.heroku.com/
Click "Try For Free", Select the option where you already have a heroku account, login with the correct credentials.
Now you can choose the database you want to perform actions on, and create "Data Clips" that your clients can run to get data reports etc (data clips can be used to run arbitrary select SQL commands).

Resources