Connect to a PostgreSQL database
Once you open the newly installed dbForge Studio for PostgreSQL on your Ubuntu machine, your first step will be to establish a connection to your database. The Studio will suggest it automatically by opening the Database Connection Properties window. Alternatively, you can access it at any moment from the Database menu > New Connection.
1. Here, you need to enter the corresponding connection properties: Host, Port, User, Password, and Database—all according to the way you configured them during the installation.
2. Optionally, you can click Test Connection. If everything has been entered correctly, you will see a corresponding message. Then click Connect, and there you go.
Configure PostgreSQL users
Like we said, the default postgres user has been created during the installation. However, you might need to create more users and provide them with respective privileges. In the Studio, it's done extremely easily. Just click New SQL on the toolbar, write a CREATE ROLE command, and run it.
To learn more about the parameters that can be used in your CREATE ROLE command, refer to the corresponding topic from the official PostgreSQL documentation.
Create and drop a PostgreSQL database
Quite similarly, you can run the CREATE DATABASE and DROP DATABASE commands, enhancing them with the available parameters. The intuitive GUI and smart code completion will make it all much simpler and faster for you.
Export and import data
With the Studio at hand, you can export PostgreSQL databases to 14 different data formats with ease.
1. First, proceed to the Database menu and select Tasks > Import Data.
2. You will be greeted by the Data Export wizard, whose first page provides you with 14 formats to choose from: HTML, TXT, XLS, XLSX, MDB, RTF, PDF, JSON, XML, CSV, ODBC, DBF, SQL, and Google Sheets. Pick the one you need and move on.
3. Next, the wizard will guide you through a number of pages where you'll be able to configure the export procedure to your requirements. These pages include Source, Output settings, Options, Data formats, Page print settings, Exported rows, and Errors handling. The availability and content of each page may vary according to the selected format.
4. Once you have configured your settings, you can simply click Export, and that's it. Your data will be exported in a matter of seconds. Note that you can do it at any moment, even without configuring anything.
5. You can save your configured settings as a template and reuse it whenever it's necessary. To do that, click Save in the lower-left corner of the wizard, and then select Save Template. You will be able to reuse it during your following export operations, eliminating the need to configure your settings anew.
6. Finally, you can set up automated export from the command line. To do that, configure your settings and click Save in the lower-left corner of the wizard, and then select Save Command Line. In the window that opens, you will see the auto-generated script; you will be able to save it as a .bat file and run it whenever you need.
Similarly, you can set up and automate the import of PostgreSQL data from external sources into your databases. The flow is basically the same. You go to the Database menu > Tasks > Import Data and follow the Data Import wizard page by page, depending on the selected format.
Analyze data and create data reports
dbForge Studio for PostgreSQL provides you with tools for more complex operations like data analysis and reporting. For instance, you can create easily readable in-depth reports based on your data (or the output of custom queries). This functionality is available from the Database menu > Report Designer. In the Data Report Wizard that opens, you can pick the required report type. To learn more about each type, refer to PostgreSQL reporting and visualization tools.
After selecting all the necessary data by executing a query and navigating to the output, you can quickly create a pivot table. To access this functionality, use Cross Tab in the Toolbox panel: simply drag it into your report. Once an empty pivot table template is created, you can drag the required fields into the corresponding parts of this table to fill it with data. To learn more about pivot tables, refer to Creating pivot tables in PostgreSQL.
Finally, you can export your report to the format of your choice, including PDF, HTML, MHT, RTF, XLS, XLSX, CSV, text files, and image files. To do that, proceed to the Export Document button on the document toolbar. Next, select the format, specify the export settings, and launch the operation.