1. Lloyd McBean
  2. PowerServer
  3. Friday, 2 September 2022 10:20 AM UTC

I am using the CASE statements for setting database connection details up to PB2021 without PowerServer

Example:

Case IS_USE_SCRIPT /* Populate Database Connection from Script */
as_dbms = "ODBC"
as_database = ""
as_userid = ""
as_dbpass = ""
as_logid = ""
as_logpass = ""
as_server = ""
as_dbparm = "ConnectString='DSN=ABCD;UID=xyz;PWD=12345Etc'"
as_lock = ""
as_autocommit = "false"

This works perfectly fine until I try running PowerServer Object.

 

When I run the powerserver object I get the following error:

---------------------------
Cannot Connect to Database, Application will now close
---------------------------
The database type cannot be confirmed because the driver information of DBMS 'ODBC' is not specified in DBParm
---------------------------
OK
---------------------------

Any pointers would be appreciated.

 

Environment is:

PB 2021, Sybase SQL Anywhere 17

 

Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 2 September 2022 10:50 AM UTC
  2. PowerServer
  3. # 1

Hi.

When you created the powerserver project, did you setup your database?

Have you read the differences that exist in powerserver projects compared to powerbuilder client server projects?

Andreas.

Comment
  1. Lloyd McBean
  2. Saturday, 3 September 2022 11:44 AM UTC
Many thanks for all the feedback.



//so my solution works and connects I just used the following:







if isPowerClientApp() or isPowerClientApp() then

m_pb_environment = false

m_web_environment = true



else



m_pb_environment = true

m_web_environment = false

end if



if m_web_environment then

as_dbms = "SNC SQL Native Client(OLE DB)"

as_server = "localhost"

as_autocommit = "true"

as_dbparm = "Database='db_server_name',DelimitIdentifier=1,cachename='XXXXX_Cache',cachegroup='default'"

return 1

else



...left old processing for client server application



end if







//other refactoring continues...
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Saturday, 3 September 2022 14:54 PM UTC
PowerClient is also client/server. So your if statement should be isPowerServerApp()

https://docs.appeon.com/pb2022/powerscript_reference/IsPowerServerApp_func.html
  1. Helpful
There are no comments made yet.
Lloyd McBean Accepted Answer Pending Moderation
  1. Friday, 2 September 2022 11:06 AM UTC
  2. PowerServer
  3. # 2

Much thanks for your feedback.  The database connection was done as needed.

 

where can I find comparison of "differences that exist in powerserver projects compared to powerbuilder client server projects?"  That might be a good start.  Thanks.

Comment
  1. Andreas Mykonios
  2. Friday, 2 September 2022 12:13 PM UTC
You can start by taking a look at https://docs.appeon.com/ps2021/quick_start.html. For databases connectivity you may take a look to https://docs.appeon.com/ps2021/working_with_database_connections.html.
  1. Helpful 1
  1. Andreas Mykonios
  2. Friday, 2 September 2022 12:23 PM UTC
  1. Helpful
  1. Andreas Mykonios
  2. Friday, 2 September 2022 12:24 PM UTC
Powerserver is running on the same machine where you do development?
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Friday, 2 September 2022 14:54 PM UTC
  2. PowerServer
  3. # 3

Hi Lloyd,

The database connection mechanism is completely different in n-tier Web server architecture, such as PowerServer.  You have to make some code changes and rethink how things will work in n-tier environment.  Here is brief summary how the architecture is different: https://docs.appeon.com/ps2022/Comparing_between_cs_app_and_installable_cloud_app.html

As Andreas pointed out, each of the databases you want to connect to need to be defined in the database configuration section of the Web API tab in the project object.  It is very important the username and password you provide has full rights to the database so that the compiler can fully access all relevant tables to generate the correct SQL.  

Once you have configured all the database connections your app would possibly need during runtime, then you will need to tell the client app which of the PowerServer database connections you want to use.  You do that by dynamically setting the "CacheName" property of the DBParm.  Here is some information about that: https://docs.appeon.com/ps2022/Dynamically_mapping_transaction_object_with_cache.html

By default, PowerServer will do a shared connection always using the username/password you specified in the configuration dialog.  If you want each user to use their own username/password to connect to the database, then you need to check the box "Allow dynamic connection..."

Last thing to note is that for SQL Anywhere specifically, it uses ODBC rather than a native driver.  So on the server (not each client app machine) the appropriate DSN must exist.  If the server is 64-bit OS then you need to configure 64-bit DSN (not 32-bit).  PowerServer by default tries to run in the highest bitness of the OS unless you explicitly compile the Web APIs for 32-bit.

Best regards,
Armeen

 

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.