Page 1 of 1

cobasystems@gmail.com

Posted: Sun Nov 10, 2019 11:53 am
by slobodan1949
Hi Master Roger,

* Problem to solve when working with ADS remote server:
*----------------------------------------------------------------
UTF-8 unicode strings should be downloaded from Oracle or PgSQL table in
the Alaska Xbase ++ DBF table, but so that the correct text is preserved.
This was only possible through an ADT table that has a 'nchar' type field
for unicode characters.

I wrote a program that uses java JDBC to transfer unicode data from
Oracle table to ADT table. The data was successfully transferred to
the ADT table.

Now it is necessary to transfer data from the ADT table to the DBF table
with the previous one translating unicode characters into Esc sequences
(one unicode character = 6 ASCII characters)
Problem: Alaska ADSDBE opens and reads the ADT board. But if the ADT
board has an 'nchar' type field then ADSDBE does not see that field.

Function ADS_ADT_TABLE () is a test program that demonstrates this.
== Roger, Is there a way that the 'nchar' field can be seen from ADSDBE ? ==

Code: Select all


#include "Appbrow.ch"
*************************************************************************
FUNCTION ADS_ADT_TABLE()
*************************************************************************
* 1. SET ADS.INI
*---------------------------------------------
*  [SETTINGS]
*  ; 1 - Local, 2 - Client, 3 - Try Client, fall back to Local, 4 - Internet (AIS)
*  ADS_SERVER_TYPE=2
*  ; NTX or CDX or ADI
*  ; ADS_INDEX_TYPE=CDX
*  ; ADS_INDEX_TYPE=NTX
*  ADS_INDEX_TYPE=ADI
*  MTIER_LOCAL_CONNECTIONS=1



* 2. SET DBESYS()
*---------------------------------------------
*  DbeLoad("ADSDBE")
*  DbeSetDefault("ADSDBE")
*  DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_ADT)
*  DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_ADT)
*  DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_PROPRIETARY_LOCKING )
*---------------------------------------------



* 3. SET APPLICATION ADS SERVER SESSION
*---------------------------------------------
  PUBLIC oSession, server_DRIVE := CurDrive() + ":"
   // connect to the ADS server
  cSession := "DBE=ADSDBE;SERVER=" + server_DRIVE
  oSession := dacSession():New( cSession )
  // check if we are connected to the ADS server
  IF ( oSession:isConnected( ) ) == .F.
       msgbox("Error: ADS Connection")
     RETURN .F.
  ENDIF


* 4. SET ADT TABLE
*-----------------

dbeSetDefault("ADSDBE")

//-------------------------------------------------- TEST1.ADT
//bErrorBlock := ErrorBlock({|e|_TrapError(e)})
//BEGIN SEQUENCE

 USE TEST1.ADT NEW

 *** Structure TEST1.ADT view in Advantage Data Architect:
 *** field name INTEGER data type numeric size 15,0
 *** field name REAL    data type numeric size 16,2


//END SEQUENCE
//ErrorBlock(bErrorBlock)

 APPBROWSE ;
 TITLE "TEST1.ADT ---> There is not Field name: UNICODE type: nchar";
 POSITION CENTER SIZE 40 PERCENT
 APPDISPLAY
 *** APPDISPLAY: INTEGER and REAL

 USE // USE is OK
//-------------------------------------------------- TEST1.ADT


//-------------------------------------------------- TEST2.ADT
//bErrorBlock := ErrorBlock({|e|_TrapError(e)})
//BEGIN SEQUENCE

 USE TEST2.ADT NEW

 *** Structure TEST2.ADT view in Advantage Data Architect:
 *** field name INTEGER data type numeric size 15,0
 *** field name REAL    data type numeric size 16,2
 *** field name UNICODE data type nchar   size  128 ***

//END SEQUENCE
//ErrorBlock(bErrorBlock)

 APPBROWSE ;
 TITLE "TEST2.ADT ---> There is a Field name: UNICODE type: nchar (not shown ?)";
 POSITION CENTER SIZE 40 PERCENT
 APPDISPLAY
 *** APPDISPLAY: INTEGER and REAL, and not UNICODE ???

 USE // USE is NOT OK: Error BASE/5:
        // Description: Internal data structures corupted
        // Operation: DbCloseArea
//-------------------------------------------------- TEST2.ADT

// disconnect from the ADS
   oSession:disconnect()
RETURN .T.

STATIC FUNCTION _TrapError()
// disconnect from the ADS
 oSession:disconnect()
 BREAK
RETURN nil


Re: cobasystems@gmail.com

Posted: Mon Nov 11, 2019 7:08 am
by rdonnay
Please attach your ADT file.

I am guessing that the problem may be in APPBROWSE.

Do you have eXpress++?

Try opening the file with Xdot.Exe and then BROWSE.

Re: cobasystems@gmail.com

Posted: Tue Nov 12, 2019 5:53 pm
by slobodan1949
Hi Roger,

I'm sending test files to TEST1.ADT and TEST2.ADT
Programs:
   CDBF.EXE
   DBFviewer PRO
   DBFplus.EXE
   DBFview.exe (Advantage Database Server client software)
cannot open TEST2.ADT file
Only the Advantage Data Architect program opens the TEST2.ADT file

ADSDBE engine opens TEST2.ADT file but no nchar field!

I'm using Alaska Xbase ++ 1.9 355 SL1
I'm using eXpress ++ Version 1.9 build 259.

Can Alaska Xbase ++ work with ADT board with nchar field ???

Re: cobasystems@gmail.com

Posted: Wed Nov 13, 2019 11:50 am
by rdonnay
I can confirm that there are problems with TEST2.ADT.

There appears to be a problem with supporting UNICODE fields with ADSDBE.

I am trying to find a workaround.

Re: cobasystems@gmail.com

Posted: Wed Nov 13, 2019 12:35 pm
by rdonnay
The only workaround that will work is using the ODBCDBE instead of the ADSDBE.

You will need to use the {Advantage StreamlineSQL ODBC} driver.

You will also need to put your ADT files into a Data Dictionary.

I tested this using SqlQuery.EXE.

I created a Data Dictionary named CobaSystems.Add with the Architect and added the ADT files.

I then made an ODBCDBE connection using the following connection string:

DBE=ODBCDBE ;
DRIVER={Advantage StreamlineSQL ODBC} ;
DataDirectory=C:\cobasystems\cobasystems.add ;
UID=AdsSys ;
ServerTypes=2

After making the connection I was able to use SQL queries or open the tables using ISAM.

Where are you located?
If you have TeamViewer or Skype I can show you this on my computer.

Re: cobasystems@gmail.com

Posted: Wed Nov 13, 2019 4:23 pm
by slobodan1949
Roger thanks for the help,

i did everything the same as you
all according to your instructions
and I got a good result.

:D

Re: cobasystems@gmail.com

Posted: Thu Nov 14, 2019 7:56 am
by rdonnay
I got a good result
That is great. I'm glad I could help.