1. Jostein Ullestad
  2. PowerBuilder
  3. Friday, 10 March 2023 13:16 PM UTC

Hi

 

We are looking for ways to connect PowerBuilder 2021.1506 application to an Azure database.


We can connect to the database using:

SQLCA.DBMS = "MSOLEDBSQL SQL Server"
SQLCA.ServerName = "tcp:<our server>.database.windows.net,<port>"
SQLCA.Database = "<our database>"
SQLCA.LogId = "UserA"
SQLCA.LogPass = "my_password"

 

Which is similar to the C# sample for Microsoft, https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-dotnet-visual-studio?view=azuresql

SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "<our server>.database.windows.net";
builder.UserID = "UserA";
builder.Password = "my_password";
builder.InitialCatalog = "<our database>";
//builder.Authentication = SqlAuthenticationMethod.ActiveDirectoryPassword;

 

Both cases are working just fine.


 

What we would like is to have the following C# code/connection working from PB as well:

SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "<our server>.database.windows.net";
builder.UserID = "noone@nowhere.no";
builder.InitialCatalog = "<our database>";
builder.Authentication = SqlAuthenticationMethod.ActiveDirectoryInteractive;

This is working from C#, but I am unable to get such working from PB

SQLCA.DBMS = "MSOLEDBSQL SQL Server"
SQLCA.ServerName = "tcp:<our server>.database.windows.net,<port>"
SQLCA.Database = "<our database>"
SQLCA.LogId = "noone@nowhere.no"
SQLCA.dbparm = "Authentication=ActiveDirectoryInteractive"

(noone@nowhere.no - Is fiction and for sample purposes only)

 

I get

---------------------------
Connect
---------------------------
SQLSTATE = HY000

Microsoft OLE DB Driver for SQL Server

Cannot open server "nowhere.no" requested by the login.  The login failed.

SQLDBCode 40532
---------------------------
OK   
---------------------------

 

Will this be achievable from PowerBuilder, if so how?

 

Thank you

Jostein

 

 

Peter Pang @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 14 March 2023 05:59 AM UTC
  2. PowerBuilder
  3. # 1

Hi Jostein,

 

  1. PowerBuilder connect to Azure database using SqlAuthenticationMethod ActiveDirectoryInteractive?

Currently, PowerBuilder does not support AAD. It can be an enhancement requirement.

 

  1. Solution:

Connect to the Database connection under C# and share the connection transaction with PB. But Net 6.0 was not supported at that time, so we need to prepare the environment for further verification of AAD.

You can refer to:

https://docs.appeon.com/pb2022/connecting_to_your_database/XREF_25339_Sharing_ADO_NET.html

 

 

Best Regards,

Peter

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.