DBeaver: how to preconfigure connections for my users? - dbeaver

I'm trying to pre-configure some connections for my users. The documentation clearly says that it is possible:
DBeaver can load multiple connection files. Any files in project folder matching .dbeaver/data-sources*.json pattern will be loaded on startup. So you can create a file, say, .dbeaver/data-sources-2.json in the project folder and DBeaver will see it.
But when I copy a file name data-sources-padrao.json to the path %USERPROFILE%\AppData\Roaming\DBeaverData\workspace6\General\.dbeaver\ before starting DBeaver for the first time, no connection is displayed and the file is renamed to data-sources-padrao.json.bak. If I copy it after starting DBeaver for the first time, the file is ignored.
How do I pre-configure a bunch of connections in DBeaver?
If the user already has a working installation, I'd like to add new connections without disturbing the old ones. If it is a fresh install, the user would open DBeaver and it would show all the connections already configured.

Ops, silly me. My data-sources-padrao.json wasn't well formed and was being ignored.
Fixed the '{' and '}' and everything is working fine. I'll leave the question here, maybe will be useful for someone.
DBeaver really considers every file named data-sources*.json in the conf dir as a connection file and will display all connections inside.

Related

Is there any way to check already preload libraries in psql or command line?

In conf we added the following line:
shared_preload_libraries = 'passwordcheck'
After restart postgres, password check is supposed to take effect, and I can test by creating a simple password for the new role. My question is:
Is there any way to list preloaded (enabled) libraries, or show this lib has been successfully loaded?
You can examine the current setting of shared_preload_libraries to see which libraries were loaded at server start time. You can be certain that these libraries are loaded, because otherwise the server would have refused to start and stopped with an error message.
But there are many other ways to load an extension shared library into PostgreSQL, for example by calling C functions or using the LOAD statement. There is no way in PostgreSQL to determine all libraries that are currently loaded into your database backend process.

PostgreSQL not recognize database

In a production server (Windows Server 2012 R2), we run out of space in the main HDD where a PostgreSQL 9.3 database was stored, so I had to move out the data directory to another drive. I followed all the steps to do it that, stop the server, move the data directory, change the folder permissions and change the -D start parameters.
I could start the server, but it only shows the default postgres db and user (I checked in pgAdmin and psql). All the files are there, even if I try to recreate the same user, I get an user already exist error. I also confirmed if the server started with the new directory (SHOW data_directory;).
Then I move back all the files to the original drive and I have the same problem.
I also checked the logs, but it shows nothing relevant to the problem.

How to backup postgres db hosted on cloud with pgadmin4?

I'm hosting my db using AWS RDS and I'm trying to backup tables. However once it's finished backing up, where is the downloaded on my computer?
Doesn't seem like theres a path to save the file
I've checked a couple of answers and others are having same issue
https://stackoverflow.com/a/29246636/11110509
The "Filename" element in that dialog box lets you pick a directory as well as file name. That is where it is. If you just typed in a filename without giving a path, then on Windows it is probably in your user's "Documents" folder.

localdb does not create database file if its missing

I use this connection-string:
Server=(localdb)\\MyInstance;Timeout=30;Database=MyDB;AttachDBFilename="C:\Temp\MyDB.mdf";Trusted_Connection=True;
Once I run a migration from my code using
dbContext.Database.Migrate();
Normally, this "simply" works. The db is not just migrated, it is also getting its file created for it.
However, on the device of a colleague, the same code results in this error message:
System.Data.SqlClient.SqlException: "Cannot attach the file 'C:\Temp\MyDB.mdf' as database 'MyDB'."
If I give my database files to my colleague and he places them in the appropiate directory first, everything works as expected and the other code in that program can access everything in it, as it would do normally.
We've tried different paths and always checked the file-system rights. LocalDB or entity-framework (I'm not sure which is normally responsible for creating database files) simply won't create the database-file if it's missing on his device.
Are there any switches causing this? Can I explicitly tell localdb with the connection-string that it should create the database file?

What is a straightforward way to connect to Postgres.app with dbext (in Vim)?

When I try to connect to my Postgres.app db using dbext, I get the following error:
dbext:PostgreSQL requires a '$HOME/.pgpass' file in order to authenticate. This file is
missing. The binary 'psql' does not accept commandline passwords.
Other programs connect just fine by using a "local" connection. (Postgres.app runs with my userid.)
In vim :!which psql correctly prints /opt/local/bin/psql (which I have symlinked to the one in the Postgres.app bin directory). And Postgres.app is set up to use "local" authentication and there's no clear sense of where a pg_hba.conf file would go (there is no etc directory in the app bundle). Moreover, Postgres.app doesn't have anything in its documentation about changing access configuration.
I've tried using dbext's :DBPromptForBufferParameters directly, as well as #tpope's vim-rails plugin (which returns without comment from dbext setup via :Rdbext.
So what do I do to get dbext to connect using a "local" connection?
Note - I spent a LOT of time trying to figure this out without trying the obvious, thus the post even when I already have the answer. I'm also curious to see if anyone else has a different approach.
It turns out you can just make an empty ~/.pgpass file (restricting read-write permissions to your userid only to avoid warnings). This was counterintuitive for me (since there is in fact no password), but I suppose in retrospect it's obvious I should have tried it.
I'll point this out on the dbext issue tracker.