1. David Sowray
  2. PowerBuilder
  3. Monday, 28 February 2022 14:12 PM UTC

We have an application we're trying to move from PB 2019 R2 Build 2353 to PB 2021 Build 1506. At the same time, we're also looking to distribute the application using PowerClient. The initial testing looks promising apart from not being able to connect to the SQL Server database using ADO.net on the test client machine.

To troubleshoot the problem, I've built a small test app, which just tests connecting to the database. The application is very simple and mainly consists of the following code:

SQLCA.DBMS = "ADO.Net"
SQLCA.LogId = "db_log_id_here"
SQLCA.LogPass = "password_here"
SQLCA.AutoCommit = true
SQLCA.DBParm = "Namespace='System.Data.SqlClient',DataSource='xxxxxxx.xxxxxxx.co.uk',Database='dbnamehere'"
connect using sqlca;
messagebox('Test PowerClient (Compiled ' + string(compiledate) + ' at ' + string(compiletime) + ')', 'SQLCA.SQLCode = ' + string(sqlca.sqlcode) + '~r~n' + sqlca.sqlerrtext)

Using PowerClient to distribute the app, the database connection fails, with the message that the PublicKeyToken was not found.

However the test app connects successfully on the client machine if I:

1) Build the application as a normal application and copy the exe and pbd file to a directory on the client machine
2) Add the Runtime\21.0.0.1506 files from the runtime directory created by PowerClient
3) Manually add a copy of Sybase.PowerBuilder.DataSource.Sharing.dll from the development machine

I therefore tried adding the Sybase.PowerBuilder.DataSource.Sharing.dll as an External File in the PowerClient project definition. When that didn't work, I tried manually adding the DLL directly to the PowerClient Runtime\21.0.0.1506 directory. Neither of these solutions work.

Is there a way to use PowerClient to distribute an application which uses an ADO.Net connection, or are we stuck using the traditional distribution methods?

Many thanks for any assistance,
David

David Sowray Accepted Answer Pending Moderation
  1. Tuesday, 1 March 2022 07:53 AM UTC
  2. PowerBuilder
  3. # 1

After tracing the application using ProcMon, I've worked out what's going wrong.

When searching for the .NET DLL files, Windows tries a number of locations, but NOT the directory with the runtime files in. So in the PowerClient project definition you need to add three files to the External Files / Files Preloaded in uncompressed format setting, so that they end up in the executable directory:

  • Sybase.PowerBuilder.Db.dll
  • Sybase.PowerBuilder.DbExt.dll
  • Sybase.PowerBuilder.DataSource.Sharing.dll

The first two are copies of files that are automatically distributed by PowerClient, but Windows can't find because PowerClient puts them in the Runtime\21.0.0.1506 directory. The third is for some reason omitted.

The application can then connect to the database without the user having to install anything with admin rights.

Hope this helps someone else.

Regards,
David

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 1 March 2022 14:51 PM UTC
Thanks so much sharing the solution!
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Monday, 28 February 2022 15:32 PM UTC
  2. PowerBuilder
  3. # 2

Adding to what Chris said, we have another option called PowerServer that compiles your project as cloud app instead of client/server. Then there is no database driver installation and configuration dependency anymore.  The client app just makes REST API calls to your server.  https://youtu.be/lowtwmc3ehY

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 28 February 2022 14:59 PM UTC
  2. PowerBuilder
  3. # 3

Hi David;

  With PowerClient,  you are still  "on the hook" to deploy & install any DBMS client driver(s) ... in your case also any .NET framework & components that these DB Clients require as well.

  Note that there is a "Preload" event that you can use in the "Run Options" tab of the PC project. In there for example, you could have the CAL call a BAT file that was deployed as part of the "external" files (ie MSI) that could complete the DB Client set-up for you. Food for thought.

Regards ... Chris

 

Comment
  1. Armeen Mazda @Appeon
  2. Monday, 28 February 2022 16:00 PM UTC
Runtime files get included by checking appropriate boxes in runtime tab. Other DLLs and any file type for that matter should be added to External Files tab.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 28 February 2022 16:33 PM UTC
1) The "Sybase.PowerBuilder.DataSource.Sharing.dll" module is part of PB's runtime "Interface" driver to the real ADO.Net sub-system. The other part of the "Interface" driver is "PBADO.dll" with requires "Sybase.PowerBuilder.DataSource.Sharing.dll" to support it which in turn calls the real ADO.Net DB Client.



2) Note that the ""Sybase.PowerBuilder.XXXX.YYYY" DLLs typically also need to be registered to the O/S. That is what the "PB Packager" MSI utility does in it's deployment installation of the PB runtime.
  1. Helpful
  1. David Sowray
  2. Monday, 28 February 2022 16:42 PM UTC
Apologies, maybe I'm not being clear.

- If I add this missing DLL to the traditionally built app, the app then works.

- If I add this missing DLL to the PowerClient distributed app, the app still doesn't work.



I have already tried adding this DLL on the External Files tab as well as adding it manually, but it doesn't fix the problem. As far as I can work out, the ADO.net connection doesn't work for PowerClient distributed apps. Are you saying there's another DLL I should be adding to the External Files tab to get it to work?
  1. Helpful
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.