Run a .bat/sh file inside ant build.xml using proenv.bat executable - Forum - OpenEdge Development - Progress Community

Run a .bat/sh file inside ant build.xml using proenv.bat executable

 Forum

Run a .bat/sh file inside ant build.xml using proenv.bat executable

This question is not answered

How we can run.bat/sh file inside ant build.xml using proenv.bat executable. I wrote following tags in my build .xml. It seems like system not firing proenv session and not excuting the .bat file as well. 

<target name="create_testdb_db_at1" >
<copy file="npui/teller.st" tofile="${DB_dir}/testdb.st" />
<antcall target="create_relative_db">
<param name="db_dir" value="${DB_dir}"/>
<param name="db_name" value="testdb"/>
<param name="df" value="npui/testdb.df"/>
</antcall>

<antcall target="encrypttellerdb" />
</target>

<target name="encrypttellerdb">
<exec dir="." executable="${env.DLC}/bin/proenv.bat">
<arg line="testdb_Encrypt.bat"/>
</exec>
</target>

Following content is from my testdb_Encrypt.bat file

REM ****
REM **** Script to enable manual encryption and encrypt a Type I Area
REM ****

set /p testdbdir="Please enter the your testdb DB location: "

echo e "Encryption Policy Area":13,32;64 . > encryptionarea.st

echo **** ADD ENCRYPTION POLICY AREA
call prostrct add %testdbdir%\testdb encryptionarea.st

echo **** ENABLE ENCRYPTION
call proutil %testdbdir%\testdb -C enableencryption -Passphrase < %testdbdir%\KeyStorePass

echo **** ENCRYPT AREA
call proutil %testdbdir%\testdb -C epolicy manage area encrypt "testdbTableArea" -Passphrase < %testdbdir%\KeyStorePass

echo **** UPDATE ENCRYPT AREA
call proutil %testdbdir%\testdb -C epolicy manage area update "testdbTableArea" -Passphrase < %testdbdir%\KeyStorePass
PAUSE

System correctly creating DB files. But it is failing to encrypt the db and launching the proenv session so I can execute my encryption script. I doing this way because I am not sure how I can pass the -KeystorePassPhrase with proutil inside build.xml.

All Replies
  • Use PCTCreateDatabase: github.com/.../PCTCreateDatabase

    There's however no built-in option for TDE, so you'll have to execute something like:

       <exec executable="${DLC}/bin/_dbutil" dir="db" inputstring="password&#xA;password&#xA;">

         <arg line="test1 -C enableencryption" />

       </exec>

  • Thanks Riverside team.

    I was looking for something like I had mentioned in my query. I have tried your suggestion as well but it is showing me KeyStorePass error. Is there any way if we can enter KeyStorePass manually here?

  • This script:

    <?xml version="1.0"?>

    <project name="PCTCreateBase-test12">

     <taskdef resource="PCT.properties" />

     <target name="test">

       <PCTCreateBase dbName="xxxx" dlcHome="${DLC}" />

       <exec executable="${DLC}/bin/_dbutil" dir="." inputstring="Admin!234&#xA;Admin!234&#xA;">

         <arg line="xxxx -C enableencryption" />

       </exec>

     </target>

    </project>

    With this xxxx.st file:

    b .

    d "Schema Area":6,64;1 .

    e "Encryption Policy Area":7,32;8 .

    Gives me:

    test:

    [PCTCreateBase] Copying DB C:\Progress\OPENED~1.7\empty8 to xxxx

        [exec] Area Encryption Policy Area/7 contains Encryption Schema (17287)

        [exec] Cipher specification being set to default AES_CBC_128 (15423)

        [exec] Manual startup option has been selected. (15425)

        [exec] The BI file is being automatically truncated. (1526)

        [exec] BI encryption enabled successfully. (15204)

        [exec] Encryption has been successfully enabled.

    You have to use input or inputstring for the passphrase. IIRC

  • An extra note, already  implied in the Riverside answer, in my experience it's easier to call the executable _dbutil directly from PCT than to try to call the .bat or .sh files