Skip to content

Commit 217a63a

Browse files
committed
2 parents 5c40a3c + b3d56e4 commit 217a63a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2568
-400
lines changed

.classpath

Lines changed: 0 additions & 8 deletions
This file was deleted.

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ build/
55

66
# This is not distributed, but contain libs for local deps management
77
external_libs/
8+
/target/
9+
10+
# eclipse files
11+
.classpath
12+
.project
13+
.settings/

.project

Lines changed: 0 additions & 17 deletions
This file was deleted.

.settings/org.eclipse.jdt.core.prefs

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.DB2.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Run sample with DB2
2+
3+
## Build the sample
4+
5+
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
6+
7+
* If you want to run the sample with MySQL, `mysql.jdbc.connector.path` should point to your JDBC driver location.
8+
* If you want to run the sample with IBM DB2, `db2.jdbc.connector.path` should point to your JDBC driver location.
9+
* `opl.home` should point to your OPL home, unless you have a `CPLEX_STUDIO_DIR128` set. (this variable should exists if you installed on a Windows machine).
10+
11+
The build file, `build.xml`, imports the build file from the OPL samples,
12+
in `<opl home>/examples/opl_interfaces/java/build_common.xml`.
13+
This build file defines all variables that are needed to configure the execution.
14+
15+
The example is compiled using the `compile` Ant target:
16+
```
17+
ant compile
18+
```
19+
The example is automatically compiled with the run Ant targets is invoked.
20+
21+
22+
23+
## Setup the sample database
24+
25+
To run the sample with DB2. you need to install DB2. DB2 Express-C is a free
26+
community edition of DB2. DB2 Express-C is available on Microsoft Windows,
27+
Linux and Mac OS.
28+
29+
You can download and install DB2 Express-C from [here](https://www.ibm.com/developerworks/downloads/im/db2express/).
30+
31+
32+
In a <em>DB2 Command Window</em>:
33+
34+
Create database using `db2 create database CUSTOMDB`
35+
36+
Run the following SQL script to create and populate the example database:
37+
```
38+
db2 -tvmf data/oil_db2.sql
39+
```
40+
41+
Before you run the sample, you need to edit `build.properties` to make `db2.jdbc.connector.path` point
42+
to your DB2 jdbc driver.
43+
44+
You can download the DB2 jdbc driver [here](http://www-01.ibm.com/support/docview.wss?uid=swg21363866).
45+
Note that if you installed DB2 Express-C, your JDBC driver is `db2jcc4.jar`
46+
in `<DB2 installdir>/SQLLIB/java`.
47+
48+
Edit `data\db_db2.xml` for your JDBC connection string and credentials.
49+
Your connection string looks like `db2://localhost:<port>/<database_name>`
50+
where `port` is the DB2 port (default is 50000), `<database_name>` is the name
51+
of your database (default is `CUSTOMDB`).
52+
53+
## Run the sample
54+
Compile and run the sample for IBM DB2:
55+
56+
```
57+
$ ant run_db2
58+
```
59+
60+
* Uses data/oil.mod as a model file
61+
* Uses data/oil.dat as a data file
62+
* Uses data/db_db2.xml to customize the JDBC custom data source.
63+
64+

README.MySQL.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Run sample with MySQL
2+
3+
## Build the sample
4+
5+
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
6+
7+
* If you want to run the sample with MySQL, `mysql.jdbc.connector.path` should point to your JDBC driver location.
8+
* If you want to run the sample with IBM DB2, `db2.jdbc.connector.path` should point to your JDBC driver location.
9+
* `opl.home` should point to your OPL home, unless you have a `CPLEX_STUDIO_DIR128` set. (this variable should exists if you installed on a Windows machine).
10+
11+
The build file, `build.xml`, imports the build file from the OPL samples,
12+
in `<opl home>/examples/opl_interfaces/java/build_common.xml`.
13+
This build file defines all variables that are needed to configure the execution.
14+
15+
The example is compiled using the `compile` Ant target:
16+
```
17+
ant compile
18+
```
19+
The example is automatically compiled with the run Ant targets is invoked.
20+
21+
22+
23+
24+
## Setup the sample database
25+
To run the sample with MySQL, you need to install MySQL. MySQL Community Server is a free edition of MySQL.
26+
27+
On Microsoft Windows, you can download and install it from [here](https://dev.mysql.com/downloads/mysql/).
28+
29+
On other plateforms, MySQL Community Server is available with most package
30+
managers. Please refer to the [installation instructions](https://dev.mysql.com/doc/refman/5.7/en/installing.html).
31+
32+
You can check your MySQL installation by running <code>mysqladmin</code>.
33+
This binary would be available in /usr/bin on linux and <msysql install dir>/bin
34+
on Windows.
35+
36+
```
37+
[root@host]# mysqladmin --version
38+
```
39+
40+
Before you run the sample, you need to run the script to create and populate
41+
sample tables.
42+
43+
Edit `data\oil_mysql.sql` for your database name. The default for the script is
44+
to create a new database. If you are not an administrator or if you don't
45+
have the permissions to create database, edit the first lines to use your
46+
database.
47+
48+
Run the script with:
49+
50+
```
51+
$ mysql < data\oil_mysql.sql
52+
```
53+
54+
You also need to download the [JDBC driver for MySQL: MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/)
55+
56+
Once the driver is download and extracted, edit property `jdbc.connector.path` in `build.properties`
57+
to include the MySQL Connector/J `.jar` (should look like `mysql-connector-java-5.1.40-bin.jar`
58+
in your MySQL Connector/J extracted diretory)
59+
60+
Edit `data\db_mysql.xml` for your JDBC connection string and credentials.
61+
Your connection string looks like `jdbc:mysql://localhost:3306/<database_name>?useSSL=false`
62+
where `<database_name>` is the name of your database (default is `custom_data_source`).
63+
64+
## Run the sample
65+
66+
Compile and run the sample for MySQL:
67+
68+
```
69+
$ ant run_mysql
70+
```
71+
72+
* Uses data/oil.mod as a model file
73+
* Uses data/oil.dat as a data file
74+
* Uses data/db_mysql.xml to customize the JDBC custom data source.

README.SQLServer.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Run sample with MS SQL Server
2+
3+
## Build the sample
4+
5+
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
6+
7+
* If you want to run the sample with MySQL, `mysql.jdbc.connector.path` should point to your JDBC driver location.
8+
* If you want to run the sample with IBM DB2, `db2.jdbc.connector.path` should point to your JDBC driver location.
9+
* `opl.home` should point to your OPL home, unless you have a `CPLEX_STUDIO_DIR128` set. (this variable should exists if you installed on a Windows machine).
10+
11+
The build file, `build.xml`, imports the build file from the OPL samples,
12+
in `<opl home>/examples/opl_interfaces/java/build_common.xml`.
13+
This build file defines all variables that are needed to configure the execution.
14+
15+
The example is compiled using the `compile` Ant target:
16+
```
17+
ant compile
18+
```
19+
The example is automatically compiled with the run Ant targets is invoked.
20+
21+
## Setup the sample database
22+
23+
To run the sample with MS SQL Server, you need to install MS SQL Server.
24+
25+
In a <em>Commnad Prompt</em> window:
26+
27+
Provided your sql server instance name is SQLEXPRESS, create database using:
28+
29+
```
30+
C:\>sqlcmd -S .\SQLEXPRESS -i data\oil_mssql.sql
31+
```
32+
33+
Before you run the sample, you need to edit `build.properties` to make `sqlserver.jdbc.connector.path` point
34+
to your MSSQL server jdbc driver (i.e. mssql-jdbc-7.2.2.jre8.jar)
35+
36+
Edit `data\db_mssql.xml` for your JDBC connection string and credentials.
37+
Your connection string looks like ` jdbc:sqlserver://localhost;instanceName=<instance>;databaseName=<database_name>;integratedSecurity=true`
38+
39+
where `instance` is the mssql instance name (default is SQLEXPRESS), `<database_name>` is the name
40+
of your database (default is `custom_data_source`).
41+
42+
## Run the sample
43+
Compile and run the sample for MS SQL Server:
44+
45+
```
46+
$ ant run_mssql
47+
```
48+
49+
* Uses data/oil.mod as a model file
50+
* Uses data/oil.dat as a data file
51+
* Uses data/db_db2.xml to customize the JDBC custom data source.

0 commit comments

Comments
 (0)