1. Daniel Vivier
  2. PowerBuilder
  3. Thursday, 24 August 2017 17:52 PM UTC

One of the features of our main app is the ability to convert data from competitors' DBs into our DB, which actually happens pretty frequently. That is done by having the client's files from the competitor's SW on the same computer that we install the current PB app onto, and usually using ODBC drivers for their database type to read their data and save it into our DB, using DataStores for the transferring.

I'm wondering how that would work in an Appeon Web version of the application, since as I understand it all DataWindow data-access work is then done on the server, not on the client. So could it read data from local files on the client?

Would part of the solution be uploading the files to the Appeon server? But can our code then even access such files? And since the DBs involved (DBase, Access, and DBISAM) aren't ones that are claimed to be supported by Appeon, would it even be able to access them, even if we were running Appeon on a Windows server and had those ODBC drivers installed?

Or is there some completely different approach we should be thinking about? I don't want to have to remove this feature. (Of course, we could offer to do it locally for a price, but honestly that's an administrative task I'd rather our small business didn't have to be involved with, given that currently the users can do it themselves!)

Thanks.

Daniel Vivier Accepted Answer Pending Moderation
  1. Friday, 25 August 2017 19:42 PM UTC
  2. PowerBuilder
  3. # 1

I think actually the best option is to use ADO (ActiveX Data Objects) directly on the client PC, assuming suitable ODBC drivers are available (which I can certainly make happen). Here's some simple sample code (obviously without much error handling):

OLEObject conn, rs
int li_return

conn = Create OLEObject
li_return = conn.ConnectToNewObject("ADODB.Connection")
if li_return <> 0 Then
    MessageBox("Test", "Cannot connect to ADODB.Connection object")
end if
// in the following, you can precede it by "Provider=MSDASQL;" but that is the default
conn.ConnectionString = "Driver=MySQL ODBC 5.3 Unicode Driver;Database=...;Port=3306;" + &
        "Server=localhost;Uid=...;Pwd=...;"
conn.Open()
rs = Create OLEObject
li_return = rs.ConnectToNewObject("ADODB.Recordset")
if li_return <> 0 Then
     MessageBox("Test", "Cannot connect to ADODB.Recordset object")
end if
// Sample select using one of our actual tables in our application (will only return 1 row, but code below handles many rows)
rs.Open("SELECT organization_name, organization_name2 from constants", conn)
do while not rs.EOF
    MessageBox("Test", rs.Fields(0).Name + ": " + rs.Fields(0).Value + "~n" + &
                         rs.Fields(1).Name + ": " + rs.Fields(1).Value)
    rs.MoveNext()
loop
rs.Close()
DESTROY rs
conn.Close()
DESTROY conn

 

Comment
  1. Daniel Vivier
  2. Saturday, 26 August 2017 12:30 PM UTC
You could also quite easily adapt that code to fill in a DW, either one created at runtime from the SQL, or an existing one, that you pull the SQL out of to run it to get the ADO RecordSet.

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 25 August 2017 13:05 PM UTC
  2. PowerBuilder
  3. # 2

Hi Dan;

   Yes as Mike well stated, this would be a great feature for Appeon Web. Appeon Mobile has this capability today. I agree, this would be a "kool" enhancement.

In the mean-time (besides just a bare bones FileRead ) .... my workaround suggestion would be to use another PB App EXE, as follows:

1) Appeon Web Apps can use the Run() command to execute local Apps.

2) Build a native PB App that interfaces with the local DBMS

3) Install the Local DB PB App on your Web client PC's. Note that Appeon Web has FIle Up/Down load functionality. So you could have the Web App download the native PB App EXE to the client's PC or you could save the local PB App's EXE + DLL's in the DBMS and the use a SelectBLOB command to download & install the local PB App on demand.

4) Call the local PB App from the Appeon Web App. While you can use the RUN() command - have a look at Roland's "Run & Wait" example on the TopWiz website or checkout my Run & Wait" in the STD Integrated Framework. Either way, these implementations would allow you to pass back return codes to the Appeon Web App for each call. You'll have to design the token passing scheme between the Web App and the Local PB App - but, that should be relatively stright forward IMHO.

5) Finally, you could now pass in or get back ANSI result set data streams and/or files that the Appeon Web App could process via the local PB App - which in turn, is brokering the local DBMS access for you.

 

Food for thought

Regards ... Chris

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 24 August 2017 20:59 PM UTC
  2. PowerBuilder
  3. # 3

You could write a Windows Service app in PowerBuilder that monitors a folder on the web server for files. They could upload the database file to the web server and the service would notice that and process their data inserting it into the database used by the Appeon Web application. It would then delete the file or move it to an archive folder.

http://www.topwizprogramming.com/pbniserv.html

 

Comment
There are no comments made yet.
Mike S Accepted Answer Pending Moderation
  1. Thursday, 24 August 2017 19:31 PM UTC
  2. PowerBuilder
  3. # 4

Local database access is not supported.   It would be pretty cool if it was, but it isn't.

you can use fileread (for flat/delimited files) as well as dll/com to process things locally.  You can have appeon server download dll/com objects that you need to use.

The final option would be to import the files to your server, then have a process on the server to handle the migration.  This could be a pure PB application (maybe kick it off via command line args), or  PB based .net / web service - but those will both require you to use a windows based server.  Or you could rewrite the server side import processing in something like python.

 

 

 

 

 

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.