opensourcecobol / Open-COBOL-ESQL-4j

Open COBOL ESQL 4J is an open-source Embedded SQL pre-compiler and run-time libraries for opensource COBOL 4J and PostgreSQL
GNU General Public License v3.0
11 stars 9 forks source link
cobol java postgresql pre-compiler scala sql

Open COBOL ESQL 4J

日本語版README

Open COBOL ESQL 4J (OCESQL 4J) consits of open-source Embedded SQL pre-compiler and run time libraries for opensource COBOL 4J.

Supported software versions

Installation and Usage

Requirements

Installation (Linux)

Install opensource COBOL 4J

See README.md of opensource COBOL 4J.

Download Open COBOL ESQL 4J

Run the following commands to download Open COBOL ESQL 4J.

curl -L -o Open-COBOL-ESQL-4j-v1.1.1.tar.gz https://github.com/opensourcecobol/Open-COBOL-ESQL-4j/archive/refs/tags/v1.1.1.tar.gz
tar zxvf Open-COBOL-ESQL-4j-v1.1.1.tar.gz
# If you don't need the downloaded file, you can delete it.
rm Open-COBOL-ESQL-4j-v1.1.1.tar.gz

Prepare jar files

You need 2 jar files.

libcobj.jar

Run the follwing commands.

cd Open-COBOL-ESQL-4j-1.1.1/
cp /usr/lib/opensourcecobol4j/libcobj.jar dblibj/lib/

If you have already installed opensource COBOL 4J, /usr/lib/opensourcecobol4j/libcobj.jar exists. When you run find /usr/lib/ -name libcobj.jar, the above path should be displayed.

postgresql.jar

In addtion, run the following commands to prepare postgresql jdbc driver. Some commands may lack permissions. In such case, prefix them with sudo.

# Move to the root directory of Open-COBOL-ESQL-4j
cd Open-COBOL-ESQL-4j-1.1.1/
mkdir -p /usr/lib/Open-COBOL-ESQL-4j-1.1.1/
curl -L -o /usr/lib/Open-COBOL-ESQL-4j-1.1.1/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.24.jar
cp /usr/lib/Open-COBOL-ESQL-4j-1.1.1/postgresql.jar dblibj/lib

sbt

See the official Installation guide.

Install Open COBOL ESQL 4J

Run the following commands.

./configure --prefix=/usr/
make
make install

Set $CLASSPATH

Add /usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar and /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar to $CLASSPATH.

export CLASSPATH="$CLASSPATH":/usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar:/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar

Installation (Windows)

Install opensource COBOL 4J

See README.md of opensource COBOL 4J.

Prepare jar files

Copy "libcobj.jar", generated by the installation of opensourcecobol4j, into "dblibj\lib". In addtion, execute the following command to prepare postgresql jdbc driver.

cd Open-COBOL-ESQL-4J
mkdir C:\ocesql4j\lib
curl -L -o C:\ocesql4j\lib\postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.24.jar
copy C:\ocesql4j\lib\postgresql.jar dblibj\lib

sbt

Download here and install it.

Install Open COBOL ESQL 4J

Install Visual Studio

The Windows version of Open COBOL ESQL 4J uses the CL compiler included in Visual Studio 2022, so you must have Visual Studio installed beforehand.

Build a solution file

  1. Download the complete set of files for opensource COBOL 4J.
  2. Open win/ocesql.sln with Visual Studio.
  3. Select "Debug" or "Release" mode. alt text
  4. Click "Build" -> "Build Solution". alt text After the build is completed, "cobj.exe" will be created in win\x64\Debug or win\x64\Release.

Build Scala Files

  1. Open PowerShell.

  2. Move to "dblibj" directory.

    cd dblibj
  3. Execute the following command.

    sbt assembly

Place files in the appropriate location

  1. If you build in Debug mode, change the 5th line of "win\install.ps1" from \x64\Release\cobj.exe to \x64\Debug\cobj.exe.
  2. Open PowerShell
  3. Move to "win" directory and execute "install.ps1".

    cd win
    .\install.ps1
    • Each file is placed in the following location.
    File name Location
    ocesql.exe C:\ocesql4j\bin
    ocesql4j.jar C:\ocesql4j\lib

Set the environment variables

  1. Add C:\ocesql4j\bin to "PATH".
  2. Add C:\ocesql4j\lib\ocesql4j.jar and C:\ocesql4j\lib\postgresql.jar to "CLASSPATH".

Contributing

Guidelines for contributing to Open COBOL ESQL 4J can be found in CONTRIBUTING.md. Contributors are listed in https://github.com/opensourcecobol/Open-COBOL-ESQL-4j/graphs/contributors