1. Suneetha Velivelli
  2. PowerBuilder
  3. Monday, 27 September 2021 22:07 PM UTC

We are using Appeon PB 2017 R3. We would like to connect to PostgreSQL. In our application specific ini file currently we are using DBMS O10. What is the equivalent one for PostgreSQL?

Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 28 September 2021 23:22 PM UTC
  2. PowerBuilder
  3. # 1

Here's the script DB2SYSPB.SQL, since I cannot attach a TXT file.

//
//  This is the script to create the Powerbuilder system tables.
//
//  Be sure to:
//  -   change all occurrences of 'PBOwner' to the name that will own
//      the Powerbuilder system tables
//  -   change all occurrences of 'database.tablespace' to the
//      appropriate value
//  -   put in appropriate statement delimiters for the tool you use
//      to execute the sql (i.e. GO statement for ISQL)
//  -   strip comments and blank lines if necessary

CREATE TABLE PBOwner.PBCATTBL
       ( PBT_TNAM  CHAR(30),
         PBT_TID  INTEGER,
         PBT_OWNR  CHAR(30),
         PBD_FHGT  SMALLINT,
         PBD_FWGT  SMALLINT,
         PBD_FITL  CHAR(1),
         PBD_FUNL  CHAR(1),
         PBD_FCHR  SMALLINT,
         PBD_FPTC  SMALLINT,
         PBD_FFCE  CHAR(18),
         PBH_FHGT  SMALLINT,
         PBH_FWGT  SMALLINT,
         PBH_FITL  CHAR(1),
         PBH_FUNL  CHAR(1),
         PBH_FCHR  SMALLINT,
         PBH_FPTC  SMALLINT,
         PBH_FFCE  CHAR(18),
         PBL_FHGT  SMALLINT,
         PBL_FWGT  SMALLINT,
         PBL_FITL  CHAR(1),
         PBL_FUNL  CHAR(1),
         PBL_FCHR  SMALLINT,
         PBL_FPTC  SMALLINT,
         PBL_FFCE  CHAR(18),
         PBT_CMNT  CHAR(254))
         IN database.tablespace
                  
 
CREATE UNIQUE INDEX PBCATTBL_IDX
       ON PBOwner.PBCATTBL
       (PBT_TNAM,
       PBT_OWNR)


GRANT SELECT, UPDATE, INSERT, DELETE ON
     PBOwner.PBCATTBL TO PUBLIC


CREATE TABLE PBOwner.PBCATCOL
       ( PBC_TNAM  CHAR(30),
         PBC_TID  INTEGER,
         PBC_OWNR  CHAR(30),
         PBC_CNAM  CHAR(30),
         PBC_CID  SMALLINT,
         PBC_LABL  CHAR(254),
         PBC_LPOS  SMALLINT,
         PBC_HDR  CHAR(254),
         PBC_HPOS  SMALLINT,
         PBC_JTFY  SMALLINT,
         PBC_MASK  CHAR(31),
         PBC_CASE  SMALLINT,
         PBC_HGHT  SMALLINT,
         PBC_WDTH  SMALLINT,
         PBC_PTRN  CHAR(31),
         PBC_BMAP  CHAR(1),
         PBC_INIT  CHAR(254),
         PBC_CMNT  CHAR(254),
         PBC_EDIT  CHAR(31),
         PBC_TAG  CHAR(254))
       IN database.tablespace        
 
CREATE UNIQUE INDEX PBCATCOL_IDX
       ON PBOwner.PBCATCOL
       (PBC_TNAM,
       PBC_OWNR,
       PBC_CNAM)


GRANT SELECT, UPDATE, INSERT, DELETE ON
     PBOwner.PBCATCOL TO PUBLIC  


CREATE TABLE PBOwner.PBCATFMT
       ( PBF_NAME  CHAR(30) NOT NULL,
         PBF_FRMT  CHAR(254) NOT NULL,
         PBF_TYPE  SMALLINT NOT NULL,
         PBF_CNTR  INTEGER)
       IN database.tablespace  
 
CREATE UNIQUE INDEX PBCATFMT_IDX
       ON PBOwner.PBCATFMT
       (PBF_NAME)

GRANT SELECT, UPDATE, INSERT, DELETE ON
     PBOwner.PBCATFMT TO PUBLIC  


CREATE TABLE PBOwner.PBCATVLD
       ( PBV_NAME  CHAR(30) NOT NULL,
         PBV_VALD  CHAR(254) NOT NULL,
         PBV_TYPE  SMALLINT,
         PBV_CNTR  INTEGER,
         PBV_MSG  CHAR(254))
       IN database.tablespace
        
CREATE UNIQUE INDEX PBCATVLD_IDX
       ON PBOwner.PBCATVLD
       (PBV_NAME)
 

GRANT SELECT, UPDATE, INSERT, DELETE ON
     PBOwner.PBCATVLD TO PUBLIC  
    

CREATE TABLE PBOwner.PBCATEDT
       (PBE_NAME CHAR(30) NOT NULL,
        PBE_EDIT VARCHAR(254),
        PBE_TYPE SMALLINT,
        PBE_CNTR INTEGER,
        PBE_SEQN SMALLINT,
        PBE_FLAG INTEGER,
        PBE_WORK CHAR(32))
       IN database.tablespace

CREATE UNIQUE INDEX PBCATEDT_IDX
       ON PBOwner.PBCATEDT
       (PBE_NAME,
       PBE_SEQN)
 
GRANT SELECT, UPDATE, INSERT, DELETE ON
     PBOwner.PBCATEDT TO PUBLIC  


//
//  The following fills the Powerbuilder Format table with
//  the default values.
//


INSERT INTO PBOwner.PBCATFMT VALUES (
    '[General]',
    '[General]',
    81,
    0)
INSERT INTO PBOwner.PBCATFMT VALUES (
    '0',
    '0',
    81,
    0)
INSERT INTO PBOwner.PBCATFMT VALUES (
    '0.00',
    '0.00',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '#,##0',
    '#,##0',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '#,##0.00',
    '#,##0.00',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '$#,##0;($#,##0)',
    '$#,##0;($#,##0)',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '$#,##0;[RED]($#,##0)',
    '$#,##0;[RED]($#,##0)',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '$#,##0.00;($#,##0.00)',
    '$#,##0.00;($#,##0.00)',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '$#,##0.00;[RED]($#,##0.00)',
    '$#,##0.00;[RED]($#,##0.00)',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '0%',
    '0%',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '0.00%',
    '0.00%',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    '0.00E+00',
    '0.00E+00',
    81,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'm/d/yy',
    'm/d/yy',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'd-mmm-yy',
    'd-mmm-yy',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'd-mmm',
    'd-mmm',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'mmm-yy',
    'mmm-yy',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'h:mm AM/PM',
    'h:mm AM/PM',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'h:mm:ss AM/PM',
    'h:mm:ss AM/PM',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'h:mm:ss',
    'h:mm:ss',
    84,
    0)  
INSERT INTO PBOwner.PBCATFMT VALUES (
    'm/d/yy h:mm',
    'm/d/yy h:mm',
    84,
    0)  

//
//  The following fills the Powerbuilder Edit Style table with
//  the default values.
//

INSERT INTO PBOwner.PBCATEDT VALUES (
    '###,###.00',
    '###,###.00',
    90,
    1,
    1,
    32,
    '10')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    '#####',
    '#####',
    90,
    1,
    1,
    32,
    '10')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    '###-##-####',
    '###-##-####',
    90,
    1,
    1,
    32,
    '00')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'MM/DD/YY',
    'MM/DD/YY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MM/YY',
    'DD/MM/YY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'MM/DD/YYYY',
    'MM/DD/YYYY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MM/YYYY',
    'DD/MM/YYYY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MMM/YY',
    'DD/MMM/YY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DDD/YY',
    'DDD/YY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DDD/YYYY',
    'DDD/YYYY',
    90,
    1,
    1,
    32,
    '20')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'HH:MM:SS',
    'HH:MM:SS',
    90,
    1,
    1,
    32,
    '30')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'HH:MM:SS:FFF',
    'HH:MM:SS:FFF',
    90,
    1,
    1,
    32,
    '30')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'HH:MM:SS:FFFFFF',
    'HH:MM:SS:FFFFFF',
    90,
    1,
    1,
    32,
    '30')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'MM/DD/YY HH:MM:SS',
    'MM/DD/YY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MM/YY HH:MM:SS',
    'DD/MM/YY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'MM/DD/YYYY HH:MM:SS',
    'MM/DD/YYYY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MM/YYYY HH:MM:SS',
    'DD/MM/YYYY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MMM/YY HH:MM:SS',
    'DD/MMM/YY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DDD/YY HH:MM:SS',
    'DDD/YY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DDD/YYYY HH:MM:SS',
    'DDD/YYYY HH:MM:SS',
    90,
    1,
    1,
    32,
    '40')  
INSERT INTO PBOwner.PBCATEDT VALUES (
    'DD/MM/YY HH:MM:SS:FFFFFF',
    'DD/MM/YY HH:MM:SS:FFFFFF',
    90,
    1,
    1,
    32,
    '40')  

 

Comment
  1. Suneetha Velivelli
  2. Thursday, 7 October 2021 16:44 PM UTC
DBA created pbcatalog tables and populated data, still I get the same message that catalog tables couldn't be created or are not in use.
  1. Helpful
  1. Olan Knight
  2. Tuesday, 12 October 2021 20:37 PM UTC
I get the same message and have no idea why that is the case.

Frankly, I did not care enough to pursue the reason for the fale error msg since everything is actually working correctly! :)
  1. Helpful
  1. Olan Knight
  2. Tuesday, 12 October 2021 20:46 PM UTC
OK, I just examined my ODBC PROFILE in PowerBuilder 2019R#. On the ODBC Profile, on the SYSTEM tabpage, I changed the value of the "Powerbuilder Catalog Table Owner" from "CHADBA" to "chadba", and I stopped getting the Catalog Table error msg.



Our version of the PG datyabase is set to LOWERCASE.
  1. Helpful 1
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 28 September 2021 23:21 PM UTC
  2. PowerBuilder
  3. # 2

Suneetha -

   THis is what I'm using as the PROFILE for my test database:

  

 


and this is the DSN:



Notice the user.

and when you click Manage DSN, I have this:


I click TEST:



In PB2019R3:
   When I CONNECT through the IDE, I do not get that message. However, I have seen it, but like Chris said once you've logged on as a user with DBA rights, the tables should get created.

   Note that I cannot see the catalog tables in the list of tables or the list of views, but when I try "select * from pbcatcol;" I get results.

   As a last option, you can always create these tables and populate them from the script DB2SYSPB.SQL provided with the install. NOTE: You DO need to tweak the script for your particular database.


Good Luck,

Olan

Comment
  1. Suneetha Velivelli
  2. Wednesday, 6 October 2021 21:54 PM UTC
Thanks Olan! We have these tables already, but there is no data. We don't have privileges to insert data in these tables as these are owned by system. We requested DBA to copy the data from oracle DB to postgreSQL. I will try again once the data is inserted.
  1. Helpful
  1. Suneetha Velivelli
  2. Thursday, 7 October 2021 16:44 PM UTC
DBA created pbcatalog tables and populated data, still I get the same message that catalog tables couldn't be created or are not in use.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 28 September 2021 13:30 PM UTC
  2. PowerBuilder
  3. # 3

Hi Suneetha;

   FYI .. HTH

Comment
  1. Suneetha Velivelli
  2. Tuesday, 28 September 2021 21:41 PM UTC
Thanks for the response! I installed the ODBC driver for PostgreSQL and created ODBC database profile setup for PostgreSQL (system DSN name: PostgreSQL35W; Platform 32bit; Driver: PostgreSQL Unicode). Test connection from ODBC is successful.

In Appeon 2017 R3 PB, in database profile, I created profile under ODB ODBC with data source as PostgreSQL35W. When tried to test connection from Preview tab, it show Error message "Catalog tables cannot be created and are not available for use". Clicked Ok, and it shows "Connection Successful".

In the ini file, I tried to replace DBMS=O10 Oracle10g (10.1.0) with DBMS=ODB ODBC. Is this correct?
  1. Helpful 1
  1. Armeen Mazda @Appeon
  2. Tuesday, 28 September 2021 21:58 PM UTC
When starting PB did you choose the Run as Admin option?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 28 September 2021 23:05 PM UTC
Hi Suneetha;

The first user that connects to any new DB must connect with DBA (Create Table) privileges so that the IDE can create the 5 PB Catalog tables. Once that is done, any normally privileged user can login without this prompt happening again.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 28 September 2021 01:04 AM UTC
  2. PowerBuilder
  3. # 4
Comment
  1. Suneetha Velivelli
  2. Tuesday, 28 September 2021 21:43 PM UTC
Thanks Olan for the response! Good tech articles, they are helfpful!

I installed the ODBC driver for PostgreSQL and created ODBC database profile setup for PostgreSQL (system DSN name: PostgreSQL35W; Platform 32bit; Driver: PostgreSQL Unicode). Test connection from ODBC is successful.

In Appeon 2017 R3 PB, in database profile, I created profile under ODB ODBC with data source as PostgreSQL35W. When tried to test connection from Preview tab, it show Error message "Catalog tables cannot be created and are not available for use". Clicked Ok, and it shows "Connection Successful". Not sure why it showed the catalog tables error before showing connection successful. In the ini file, I tried to replace DBMS=O10 Oracle10g (10.1.0) with DBMS=ODB ODBC. Is this correct?
  1. Helpful 1
  1. Chris Pollach @Appeon
  2. Tuesday, 28 September 2021 23:07 PM UTC
Yes, SQLCA.DBMS = "ODB" would be correct. Also, you'll need an updated DBPARM field values as well for the DSN name to use.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 27 September 2021 22:26 PM UTC
  2. PowerBuilder
  3. # 5

Hi Suneetha;

   PB's support for PostgreSQL is via the ODBC driver. You can read all about this in the PB help.

Regards ... Chris

Comment
  1. Suneetha Velivelli
  2. Tuesday, 28 September 2021 21:48 PM UTC
Thanks Chris for the response! I will check in PB help.
  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.