Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to programmatically retrieve db password with sdk?

hello all,

i'd like to instance a sqlconnection from an addin in order to directly connect to sap db, using microsoft sql client default libraries...

we are facing serious performance problems with simple queries using the standard sdk object recordset.

we tried building the connection string with this method but the property dbpassword is always a bunch of *

public static String GetSQLClientConnectionString()

        {

            String retVal = String.Empty;

            String connStringBase = "Server={0};Database={1};User Id={2};Password={3};";

            retVal = String.Format(connStringBase,

                                        CompanyHelper.Instance.Company.Server,

                                        CompanyHelper.Instance.Company.CompanyDB,

                                        CompanyHelper.Instance.Company.DbUserName,

                                        CompanyHelper.Instance.Company.DbPassword);

            return retVal;

        }

as documentation tells us about dbproperty this is an expected beahaviour:

Description

Sets or returns the password for establishing a connection to the database server.

The field is not mandatory, as the database credentials are stored in the license server and you can use these values instead.

Property type

Read-write property

Syntax

Visual Basic

Public Property DbPassword() As String

Remarks

When you retrieve the value of the DbPassword field, ****** is returned.

If you set a value to the DbUserName field, then that value is returned when you get a value from this field. If you connected without providing a database user name (relying on the credentials stored in the license server), then an empty string is returned.

now i'd like to know if it is possible to get a clear password in order to build a proper sql connection string without storing it in a configuration file?

thanks in advance

Tags:
Not what you were looking for? View more on this topic or Ask a question