I am creating a firebird database dynamically using SYSDBA. I want to create a user with some privileges and then open this database using the new user. Can anyone help, please?
var csb = new FbConnectionStringBuilder(@"DataSource=localhost;User=SYSDBA;Password=mw;Database=test.fdb;") { Pooling = false };
FbConnection.CreateDatabase(csb.ConnectionString, 16384, false, true);
FbConnection myConn = new FbConnection(csb.ConnectionString);
try
{
myConn.Open();
string sql = "CREATE USER user123 PASSWORD 'user123pass';
FbCommand cmd = new FbCommand(sql, myConn);
cmd.ExecuteNonQuery();
}
catch (System.Exception ex)
{
error = ex.ToString();
}
finally
{
if (myConn.State == ConnectionState.Open)
{
myConn.Close();
}
}
When executing this code, it throws the following exception.
FirebirdSql.Data.FirebirdClient.FbException (0x80004005): add record error violation of PRIMARY or UNIQUE KEY constraint "INTEG_5" on table "PLG$SRP"