symmetricsDS and postgresql - postgresql

I wan't to replicate two databases with symmetricDS,
First, i try to do this tutorial https://www.symmetricds.org/doc/3.8/html/tutorials.html
i have install symmetricDs I have installed symmetricDS on my postgresql serveur.
and execute this commands :
../bin/dbimport --engine corp-000 --format XML --alter-case create_sample.xml
../bin/symadmin --engine corp-000 create-sym-tables
../bin/dbimport --engine corp-000 insert_sample.sql
bin/sym
But No tables was write in my database, and no symmetric table too
Can't you help ?

Verify that the user account provided to connect your SymmetricDS nodes has the ability to create tables. Then I would check the symmetric.log for any obvious errors. By default it would create the tables in the default schema of the user account provided so be sure to check that schema for the tables.

Related

Prisma/ PostgreSQL: What are are the user privileges required while using Prisma with PostgreSQL?

I am using PostgreSQL as my database along with Prisma as my ORM.It seems to be giving an issue while running the 'prisma migrate' command on the server which seems to be an issue of user database privileges not being present.What are the basic user privileges that are required for Prisma while using Postgres apart from the option of giving full admin rights?
Database user needs to have a CREATEDB privilege for using migrate commands in PostgreSQL.
Here's a reference to privileges needed for each supported database: Reference.

prisma db pull doesn't see a new table

I have existing schema for prisma.
I copied the table from another schema to be included in the Prisma schema.
But when I run prisma db pull new table doesn't appear in Prisma schema.
Why?
If you use supabase and running this command and it returns something like this 'The following models were commented out because we couldn't retrieve columns for them. Please check your privileges.' or something similar regarding privileges, the solution is to go to your SQL editor from supabase and put this command and execute it
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO postgres;
You're misinterpreting the function of the prisma db pull command.
From the docs
The db pull command connects to your database and adds Prisma models to your Prisma schema that reflect the current database schema.
Basically, it will make your Prisma schema match the existing database schema. What you want is the opposite here: Update the database schema to match the current Prisma schema.
You can do this in two ways:
If you want to update the database and keep the changes in your migration history, use the prisma migrate dev command. More Info
If you just want to update the database without creating a migration, use the prisma db push command. More info
More information is available in the docs explaining how you should choose between 1 and 2.
I had a similar issue once and a quick check confirmed for me that it was the lack of security permissions granted for prisma on new table in the database itself.
Try this:
Note the name of the database user that Prisma connects to the database with. You'll likely find this via your schema.prisma file, or perhaps via a DATABASE_URL config setting in the related .env file if you're using that with prisma.
Go into the database itself and ensure that database user which Prisma connects with has been granted sufficient security privileges to that new table. (note: what 'sufficient' is I cannot say since it depends on your own needs. At a guess, I'd say at least 'select' permission would be needed.)
Once you've ensure that user has sufficient privileges, try running a prisma db pull command once again.
For reference, another thing you could do is:
cross-check against one of the other tables that is already in your database that works correctly with prisma.
compare the security privileges of that old table with the security privileges of the new table and see if there are any differences.

Can't create new schema in an OVH postgres

I have a PostgreSQL server on OVH's Cloud DB and have been using its databases for my web apps.
So far so good.
I got a project where It's a requirement to have schemas. Strangely enough, I am unable to create schemas on the user with "Administrator" privileges.
I have prepared scripts using schemas, so I just need to run them on a prepared database but I need a database with schemas to run them.
Here is my process:
Create a new database
Select option "Create user"
Select option for privilages: "Administrator"
Commit configuration
Wait for database creation
Connect to database with the new config via PGAdmin
Run command create schema if not exists "vMobile";
Recieve following error:
ERROR: permission denied for database my-database-dev
SQL state: 42501
I created a ticket for this but the wait is taking too long.
Support answer
Ok, so I got a response from the OVH support and there is no option for the user to create new schemas as their CloudDB enables access only to schema public and mentioned privileges Administrator, Read/Write, Read, None are only applicable to the public schema.
Workaround
My solution to this is to create tables with schema name included in their names
like so:
Desired outcome: "vCommon"."Route"
Workaround: "public"."vCommon_Route"

WSO2 Identity Server PostgreSQL Database Schema

Can I change PostgreSQL database schema in WSO2 IS? For default, it is public, but I want to change it to my custom one.
Please, help.
EXPLANATION:
I connected PostgreSQL database as primary database into WSO2 IS. First run wso2server.bat with -Dsetup parameter and all database tables was created in public schema of connected database.
I hope, that I can change default public schema to my own, for example wso2.
Yes it's possible. You have to modify the db scripts to use the custom schema with following line at the scripts.
SET search_path TO wso2;
Then set the search_path to include the schema you are using.
Refer the post here for more detailed steps.

PostgreSQL - create a new DB through pgAdmin UI

I have installed PostgreSQL DB server on my Ubuntu machine. Now I want to create a new Database through some GUI application. I tried pgAdmin but didn't find any option to create a new DB. But I could add existing db servers.
Is there any way to create a DB and then tables through pgAdmin or some other app.
Basically I am looking for an application for PostgreSQL like SQLYog for MySQL.
Open pgAdmin
Connect to database server
Edit => New Object => New database
done
Or use plain SQL when connection to any database: CREATE DATABASE my_database;
HI ... Verify that u have done above steps to install the postgresql properly ... and follow the below instructions to create a database in POSTGRESQL
INSTALL POSTGRESQL
1.Install latest PostgreSQL 9.1 in console:
sudo apt-get install postgresql libpq-dev
2.PostgreSQL has a super user is called postgres. Change user to the PostgreSQL user:
sudo su - postgres
3.Change password of postgres user:
psql -d postgres -U postgres
psql (9.1.3) Type "help" for help
postgres=# alter user postgres with password 'YOUR_NEW_PASSWORD';
ALTER ROLE
postgres=# \q
#logout postgres user
logout
4.Restart the PostgreSQL server:
sudo /etc/init.d/postgresql restart
pgAdmin III: PostgreSQL administration and management tools
If pgAdminIII is not installed, the installation is easy:
sudo apt-get install pgadmin3
ADD A SEVER
Open pgAdminIII and add new localhost server. Go to menu File > Add Server
Set up pgAdmin III server instrumentation:
When connecting to a PostgreSQL database using pgAdmin you may receive an error letting you know that the server instrumentation is not installed.
Install postgresql-contrib package:
sudo apt-get install postgresql-contrib
Install adminpack extension:
sudo -u postgres psql
postgres=# CREATE EXTENSION "adminpack";
postgres=# \q
CREATE DATABASE
1.Double Click your database in Left pane on PGAdmin to select it
2.Now click the a Icon named "SQL" ,probably 6th icon, and type CREATE table query in resultant window
EXAMPLE:
3.Create table query
CREATE TABLE explore(
SUBJECT TEXT NOT NULL,
COMPANY CHAR(50) NOT NULL,
PNAME TEXT NOT NULL,
PHONE INT NOT NULL,
EMAIL CHAR(50) NOT NULL,
REMARKS CHAR(200) NOT NULL
);
Post any queries below.............Have a error free day.
One of problems with DB creating is connected to permissions.
If there are no grant for creating database, the path "Object -> Create -> Database" is off (unclickable) and you can't pick this menu option. Likewise, "Databases -> Right Mouse Button" doesn't have "Create" option. One more sign of this case is the reaction in SQL:
CREATE DATABASE DBNAME;
ERROR: permission denied to create database
********** Error **********
To solve the problem you can reconnect to the Server with the first login ('postgres' for example). And afterwards the menu will work.
Of course you can create a database with pgAdmin.
You have to understand the basic concept of PostgreSQL. First you have to connect to a database cluster, which you can only do by connecting to a database in that cluster. Now, if your database does not exist, yet, there is the default maintenance db postgres you can connect to. Connect to it and issue CREATE DATABASE there. Then change to the new database.
On windows right click on the db connector
My db connector is PostgreSQL->Create->Database, expand the database
Next expand schema
under which tables is found, then right click, and create tables
To create tables Expand database->under that expand schema->under tables , click on create tables
To add columns and data types to tables
under the respective table, right click properties and select column fields and add name of columns, data types as needed properties->columns
So, I'm late to the party, but it seems that regular old PG_Admin, and the EnterpriseDB installation are different packages. PG_Admin by itself just manages and connects to servers, but doesn't seem to create them. This is definitely not clear, but yeah you get those errors because you're trying to connect to a server that doesn't exist. You could also use WSL to do this, but you'd have to have WSL and your server up and running everytime to you play.