Changing the database account password

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
pconway
Posts: 2
Joined: Mon 02 Nov 2020 00:15

Changing the database account password

Post by pconway » Mon 02 Nov 2020 01:00

Hello, we recently purchased dotConnect for PostgreSQL. We're currently using it to connect to a local PostgreSQL database.

Is it possible to change the database account password using the dotConnect software? (i.e. not the password in the connection string, but the password that PostgreSQL server accepts)

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Changing the database account password

Post by Shalex » Tue 03 Nov 2020 17:39

Try this code:

Code: Select all

  var conn = new Devart.Data.PostgreSql.PgSqlConnection();
  conn.ConnectionString = "...";
  conn.Open();
  var cmd = conn.CreateCommand();
  cmd.CommandText = "ALTER USER username WITH PASSWORD 'newpassword'";
  cmd.ExecuteNonQuery();

pconway
Posts: 2
Joined: Mon 02 Nov 2020 00:15

Re: Changing the database account password

Post by pconway » Mon 09 Nov 2020 15:33

That worked. Thank you!

Post Reply