Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding .gitattributes file #940

Merged
merged 13 commits into from
May 21, 2024
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This .gitattributes file will cause all text files EXCEPT for
# git's .gitattributes and .gitignore files to be encoded as EBCDIC.
# Selected binary files will not be translated at all.
# The default for text files
* git-encoding=iso8859-1 zos-working-tree-encoding=ibm-1047
# git's files (which MUST be ASCII)
.gitattributes git-encoding=iso8859-1 zos-working-tree-encoding=iso8859-1
.gitignore git-encoding=iso8859-1 zos-working-tree-encoding=iso8859-1
# Binary files, selected by file extension.

# Other platforms don't use the BINARY term, But do recognize "binary" macro
*.jpg git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.jar git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.jpg git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.node git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.png git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.PNG git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.tar git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.tgz git-encoding=BINARY zos-working-tree-encoding=BINARY binary
*.zip git-encoding=BINARY zos-working-tree-encoding=BINARY binary
6 changes: 3 additions & 3 deletions .github/workflows/bld_wheels_and_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
env:
CIBW_BUILD: "*-win_amd64"
CIBW_SKIP: "cp36-* pp*"
- uses: actions/upload-artifact@v4.3.1
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

Expand All @@ -50,11 +50,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest,ubuntu-latest]
os: [macos-13,ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.2
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: "cp36-* *-musllinux_* pp* *-*linux_{aarch64,ppc64le}"
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2024-03-13, Version 3.2.3
=========================

* Downgrade upload-artifact on 64 bit Windows (#919) (Bradley Reynolds)

* Upgrade cibuildwheel on Linux & Mac OS job (#920) (Bradley Reynolds)


2024-03-02, Version 3.2.2
=========================

Expand Down
157 changes: 99 additions & 58 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,87 +21,105 @@ DEALINGS IN THE SOFTWARE.

## Contents

1. [ibm_db Installation on Linux](#inslnx)
2. [ibm_db Installation on AIX on Power Systems](#insaix_p)
3. [ibm_db Installation on Linux on System z](#inslnx_z)
4. [ibm_db Installation on Windows](#inswin)
5. [ibm_db Installation on MacOS](#insmac)
6. [ibm_db Installation on z/OS](#inszos)
7. [ibm_db installation on MacOS M1/M2 Chip System](#m1chip)
8. [Troubleshooting Post Install Errors](#troubleshooting)
1. [ibm_db Installation on Linux, AIX, zLinux, Widnows and MaxOS(x64) with Intel Chip.](#inslnx)
2. [ibm_db Installation on z/OS](#inszos)
3. [ibm_db installation on MacOS M1/M2 Chip System](#m1chip)
4. [Troubleshooting Post Install Errors](#troubleshooting)
- [SQL30081N Error](#sql30081n)
- [Symbol not found error or malloc error](#symbolerror)


## <a name="inslnx"></a> 1. Python-ibm_db Installation on Linux.
## <a name="inslnx"></a> 1. Python-ibm_db Installation on Linux, AIX, zLinux, Windows and MaxOS(x64) with Intel Chip.

### Install python-ibm_db

Below are the steps to install [*python-ibm_db*](https://github.com/ibmdb/python-ibm_db) from github or pip.

#### 1.1 Direct Installation.
#### 1.1 Direct Installation using pip.
To install ibm_db and ibm_db_dbi module.
```
pip install ibm_db
```
or
```
pip install git+https://git@github.com/ibmdb/python-ibm_db.git
```
* `pip install ibm_db` installs python wheel images on Linux, Windows and MacOS(x64) for python v>=3.7
* If wheel image is not available or for AIX and zLiux, native C++ code of ibm_db requires in-system compilation. For such case,
you should have a C++ compiler installed in the system. Make sure the commands `gcc --version` and `make --version` works
fine on Linux and MacOS system.
* For AIX and zLinux, you should have xLC Compiler intalled in the system. Also, `make` should be installed.
* For other pre-requisite and non-wheel installation, please check [here](https://github.com/ibmdb/python-ibmdb?tab=readme-ov-file#installation).

#### 1.2 Manual Installation by using git clone.
**Note:**
When we install ibm_db package on Linux, MacOS and Windows, `pip install ibm_db` command install
prebuilt Wheel package that includes clidriver too and ignores `IBM_DB_HOME` or `IBM_DB_INSTALLER_URL`
environment variables if set. Also, auto downloading of clidriver does not happen as clidriver is
already present inside wheel package.

To inforce auto downloading of clidriver or to make setting of environment variable `IBM_DB_HOME`
effective, install ibm_db from source distribution using below command:
```
pip install ibm_db --no-binary :all: --no-cache-dir
```
git clone https://github.com/ibmdb/python-ibm_db/
cd python-ibmdb
python setup.py build
python setup.py install
````

## <a name="insaix_p"></a> 2. Python-ibm_db Installation on AIX on Power Systems.

### 2.1 Install python-ibm_db

Follow the same steps mentioned in [Python-ibm_db Installation on Linux](#inslnx).


## <a name="inslnx_z"></a> 3. Python-ibm_db Installation on Linux on System z.

### 3.1 Install python-ibm_db

Follow the same steps mentioned in [Python-ibm_db Installation on Linux](#inslnx).


## <a name="inswin"></a> 4. Python-ibm_db Installation on Windows.

Below are the steps to install [*python-ibm_db*](https://github.com/ibmdb/python-ibm_db) from github or pip.

#### 4.1 Direct Installation.
If you have to use your own URL for clidriver.tar.gz/.zip please set environment variable
```
pip install ibm_db
IBM_DB_INSTALLER_URL=full_path_of_clidriver.tar.gz/.zip
```
or
When ibm_db get installed from wheel package, you can find clidriver under site_packages directory
of Python. You need to copy license file under `site_packages/clidriver/license` to be effective, if any.

**Note:** For windows after installing ibm_db, recieves the below error when we try to import ibm_db :
```>python
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing ibm_db: The specified module could not be found.
>>>
```
We need to make sure to set dll path of dependent library of clidriver before importing the module as:

```
pip install git+https://github.com/ibmdb/python-ibmdb.git
import os
os.add_dll_directory('path to clidriver installation until bin')
import ibm_db

e.g:
os.add_dll_directory('C:\\Program Files\\IBM\\CLIDRIVER\\bin')
import ibm_db
```
Refer https://bugs.python.org/issue36085 for more details.

#### 4.2 Manual Installation by using git clone.

#### 1.2 Manual Installation by using setup.py

```
git clone https://github.com/ibmdb/python-ibm_db/
cd python-ibmdb
python setup.py build
python setup.py install
````
pip list
```

## <a name="insmac"></a> 5. Python-ibm_db Installation on MacOS.
- `python setup.py install` command, installs python egg under site_packages.

### 5.1 Install python-ibm_db
#### 1.3 Manual Installation using python wheel (Only Linux, Windows and MacOS(x64))

Follow the same steps mentioned in [python-ibm_db Installation on Linux](#inslnx).
To install ibm_db as python wheel, use below commands(recommended):
```
git clone https://github.com/ibmdb/python-ibm_db/
cd python-ibmdb
python -m build => Note down the path of generated *.whl file to use below
pip install dist/ibm_db-3.2.3-cp311-cp311-win_amd64.whl
pip list => You can see ibm_db in the output
```

## <a name="inszos"></a> 6. ibm_db Installation on z/OS
## <a name="inszos"></a> 2. ibm_db Installation on z/OS

### 6.1 Install Python for z/OS
### 2.1 Install Python for z/OS

Below steps were followed for the same:

Expand All @@ -114,7 +132,7 @@ Below steps were followed for the same:
-- UI72589 (v12)
```

### 6.2 Configure ODBC driver on z/OS
### 2.2 Configure ODBC driver on z/OS
Please refer to the [ODBC Guide and References](https://www.ibm.com/support/knowledgecenter/SSEPEK/pdf/db2z_12_odbcbook.pdf) cookbook for how to configure your ODBC driver. Specifically, you need to ensure you have:

1. Binded the ODBC packages. A sample JCL is provided in the `SDSNSAMP` dataset in member `DSNTIJCL`. Customize the JCL with specifics to your system.
Expand Down Expand Up @@ -240,7 +258,7 @@ export DB2_MACS=$IBM_DB_HOME.XXXX

Reference Chapter 3 in the [ODBC Guide and References](https://www.ibm.com/support/knowledgecenter/SSEPEK/pdf/db2z_12_odbcbook.pdf) for more instructions.

### 6.3 Verify python installation
### 2.3 Verify python installation
1. Make sure when python is installed, you validate the same by typing &quot;python3 -V&quot; and it should return 3.8.3 or greater.
- Unless you are a sysprog you'll likely not have authority to create the site-package so consider using a python virtual environment as following:
```
Expand All @@ -257,17 +275,17 @@ import ibm_db
conn = ibm_db.connect('','','')
```

### 6.4 Installing Python driver for Db2 i.e. ibm\_db &amp; Running a validation Program
### 2.4 Installing Python driver for Db2 i.e. ibm\_db &amp; Running a validation Program

Now that the Python and ODBC is ready, for connecting to Db2 you need a Db2 Python driver which we are going to install.

Follow the standard steps for the same i.e. pip3 install ibm_db

### 6.5 Install python-ibm_db
### 2.5 Install python-ibm_db

Below are the steps to install [*python-ibm_db*](https://github.com/ibmdb/python-ibm_db) from github or pip.

#### 6.5.1 Direct Installation.
#### 2.5.1 Direct Installation.
```
pip install ibm_db
```
Expand All @@ -276,7 +294,7 @@ or
pip install git+https://git@github.com/ibmdb/python-ibm_db.git
```

#### 6.5.2 Manual Installation by using git clone.
#### 2.5.2 Manual Installation by using git clone.

```
git clone https://github.com/ibmdb/python-ibm_db/
Expand Down Expand Up @@ -307,9 +325,9 @@ else:
print('ODBC Test end')
```

## <a name="m1chip"></a> 7. ibm_db installation on MacOS M1/M2 Chip System (arm64 architecture)
## <a name="m1chip"></a> 3. ibm_db installation on MacOS M1/M2 Chip System (arm64 architecture)

### 7.1 Install GCC using Homebrew
### 3.1 Install GCC using Homebrew

**Warning:** If you use the ARM version of homebrew (as recommended for M1/M2 chip systems) you will get the following error message:
```
Expand Down Expand Up @@ -345,7 +363,7 @@ Suppose path of gcc lib is `/usr/local/homebrew/lib/gcc/12`. Then update your .b
export DYLD_LIBRARY_PATH=/usr/local/homebrew/lib/gcc/12:$DYLD_LIBRARY_PATH
```

### 7.2 Steps to Install Intel Python after verifying setup
### 3.2 Steps to Install Intel Python after verifying setup

Several things might be necessary to get `ibm_db` working on the Apple Silicon architecture:

Expand Down Expand Up @@ -377,7 +395,7 @@ Several things might be necessary to get `ibm_db` working on the Apple Silicon a
* Verify the output of `gcc -v` command. It should show `Target: x86_64-apple-darwin21` in output.
* Install Intel Version of Python like: https://www.python.org/ftp/python/3.9.11/python-3.9.11-macosx10.9.pkg

### 7.3 Install ibm_db with x86_64 version of gcc12 and Python on M1/M2 Chip System
### 3.3 Install ibm_db with x86_64 version of gcc12 and Python on M1/M2 Chip System

* Open a new terminal and run below commands:
```
Expand All @@ -388,13 +406,13 @@ pip3 install ibm_db
```
Now, run your test program to verify.

## <a name="troubleshooting"></a> 8. Troubleshooting Post Install Errors
## <a name="troubleshooting"></a> 4. Troubleshooting Post Install Errors

<a name="sql30081n"></a> 8.1 SQL30081N Error
<a name="sql30081n"></a> 4.1 SQL30081N Error

* If connection fails with SQL30081N error: means `ibm_db` installation is correct and you need to provide correct connection string.

<a name="symbolerror"></a> 8.2 Symbol not found error or malloc error
<a name="symbolerror"></a> 4.2 Symbol not found error or malloc error

* If `import ibm_db` fails with `Symbol not found: ___cxa_throw_bad_array_new_length` error or `malloc` error:
You need to find the correct location of lib/gcc/12 directory and add it to DYLD_LIBRARY_PATH environment variable.
Expand All @@ -414,3 +432,26 @@ i.e. change current path of `libstdc++.6.dylib` in `libdb2.dylib` library to the

Now run your test program and verify.


# M1 MAC Steps to Install IBM DB and Support Docker RUN
## Installation Steps:
### Install Podman / Docker:
- **Podman:** Follow the instructions provided on the [official Podman website](https://podman.io/getting-started/installation) to install Podman on your M1 Mac.
- **Docker:** Alternatively, you can install Docker using the native Apple Silicon version or the Rosetta-translated Intel version. Choose the method that best fits your requirements.
### Install Intel Version of Python:
1. Download and install the Intel version of Python 3.8 from the [official Python website](https://www.python.org/downloads/release/python-3810/).
2. After installation, ensure that you set the interpreter to Python 3.8 in your development environment.
## Configuration Steps:
### Configure Docker for M1:
- For M1 Macs, ensure compatibility by specifying the platform architecture during Docker build commands:
docker build -t <image_name> . --platform=linux/amd64
Alternatively, if you're using Podman:
podman build -t <image_name> . --platform=linux/amd64
### Build Docker Image (Intel):
- If you're using an Intel Mac or running Docker with Rosetta translation, use the following command to build your Docker image:
docker build -t <image_name> .
## Additional Notes:
- These steps are tailored for M1 Macs to ensure seamless installation and configuration of IBM DB and Docker support.
- Verify that your Dockerfile and any dependencies are compatible with the specified platform architecture.
Follow these steps carefully to set up IBM DB and Docker support on your M1 Mac environment. If you encounter any issues or have further questions, feel free to seek assistance from the community or relevant support channels.
Happy coding!
Loading
Loading