1. Albert van Bochove
  2. PowerBuilder
  3. Monday, 8 April 2024 20:14 PM UTC

Hello, I have the following connection string:


sqlca.dbms = "value"
sqlca.database = "database_name"
sqlca.servername = "server_name"
sqlca.dbparm="ConnectString='DSN=database_name',DisableBind=1,DelimitIdentifier='No',StripParmNames='Yes',CallEscape='No',MsgTerse='Yes',FormatArgsAsExp='N',TrustedConnection=1 "
sqlca.userid = "user_name"
sqlca.logid = "user_name"

and I need to do it as an if - else sentence, for example if it is user1 and password1, then use the following connection string ... , else if: if it is user 2 with pass2, then use the connection string 2.

how can I do this, so far I can only make it possible to connect with a single user configuration.

Thanks in advance.

 

Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 10 April 2024 13:09 PM UTC
  2. PowerBuilder
  3. # 1

Since you are using ODBC, you need to pass userid & password and other options in the DBParm. Something like this:

sqlca.DBMS = "ODBC"
sqlca.DBParm =  "ConnectString='DSN=" + ls_profile + ";" + "UID=" + ls_userid + ";" + &
                        "PWD=" + ls_password + ";Trusted_Connection=no;Encrypt=no'"

 

Comment
There are no comments made yet.
Albert van Bochove Accepted Answer Pending Moderation
  1. Tuesday, 9 April 2024 13:20 PM UTC
  2. PowerBuilder
  3. # 2

Chris, Thanks for your quick respone. Still I need help.

When I put my onection configuration to the database: following your suggestion:
sqlca.dbms = "ODBC"
sqlca.database = "database_name"
sqlca.servername = "server_name"
sqlca.dbparm="TrustedConnection=1"

The system asks me before entering the credentials, the system asks me to choose ekl odbc connection. first

 

and then

 

. With the connection string that I configured in the definition of my question, it does not ask me to select Data Source, so your suggestion does not help me solve the problem, on the contrary, it created another problem for me.

 

 

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 9 April 2024 17:42 PM UTC
Hi Albert;

Since ODBC is "Middle-ware" and not a direct connection to the DBMS. The User ID & Password are passed in differently than when you are using a native DBMS driver. We would need to know a lot more about the specific DBMS, version, build, etc that you are trying to use.

Regards .. Chris
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 8 April 2024 20:38 PM UTC
  2. PowerBuilder
  3. # 3

Hi Albert;

  You have set your dbparm to use a "trusted connection" setting thus, your PB App will only use the current Windows User login credentials & ignore your user / password settings.

Regards ... Chris 

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.