Skip to content

Commit 53d4241

Browse files
committed
updated README's with more instructions to download and setup jdbc drivers
1 parent e2622c1 commit 53d4241

File tree

3 files changed

+117
-21
lines changed

3 files changed

+117
-21
lines changed

README.DB2.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
## Build the sample
44

5-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5+
Samples [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat) and
6+
[studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
7+
section.
8+
9+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
610

7-
* If you want to run the sample with MySQL, `mysql.jdbc.connector.path` should point to your JDBC driver location.
811
* If you want to run the sample with IBM DB2, `db2.jdbc.connector.path` should point to your JDBC driver location.
912
* `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).
1013

@@ -38,19 +41,41 @@ Run the following SQL script to create and populate the example database:
3841
db2 -tvmf data/oil_db2.sql
3942
```
4043

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.
4344

4445
You can download the DB2 jdbc driver [here](http://www-01.ibm.com/support/docview.wss?uid=swg21363866).
4546
Note that if you installed DB2 Express-C, your JDBC driver is `db2jcc4.jar`
4647
in `<DB2 installdir>/SQLLIB/java`.
4748

48-
Edit `data\db_db2.xml` for your JDBC connection string and credentials.
49+
Depending on the sample you run, you need to edit, `build.properties` to make `db2.jdbc.connector.path` point
50+
to your DB2 jdbc driver.
51+
52+
Depending on the sample you run, you need to edit `build.properties` to make
53+
`db2.jdbc.connector.path` point to your DB2 jdbc driver (i.e. db2jcc4.jar).
54+
55+
On samples like [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat),
56+
you will need to edit your `.dat` so that the following line points to where your jdbc driver resides:
57+
58+
```
59+
IloOplImportJava("../../external_libs/db2jcc4.jar")
60+
```
61+
62+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
63+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
64+
65+
```
66+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
67+
if (! jdbc_driver ) {
68+
jdbc_driver = "../../external_libs/db2jcc4.jar"; // default for this project
69+
}
70+
```
71+
72+
For sample [oil](examples/oil), edit `data\db_db2.xml` for your JDBC connection string and credentials.
4973
Your connection string looks like `db2://localhost:<port>/<database_name>`
5074
where `port` is the DB2 port (default is 50000), `<database_name>` is the name
5175
of your database (default is `CUSTOMDB`).
5276

53-
## Run the sample
77+
## Run the oil sample
78+
5479
Compile and run the sample for IBM DB2:
5580

5681
```
@@ -61,4 +86,12 @@ $ ant run_db2
6186
* Uses data/oil.dat as a data file
6287
* Uses data/db_db2.xml to customize the JDBC custom data source.
6388

89+
## Other samples
90+
91+
The other samples do not need to be compiled, and will use `oplrun` executable. Each sample directory
92+
contains a convenience `run.bat` command line to run the sample. Otherwise you run them using the `run` target:
93+
94+
```
95+
$ ant run
96+
```
6497

README.MySQL.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
## Build the sample
44

5-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5+
Samples [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat) and
6+
[studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
7+
section.
8+
9+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
610

711
* 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.
912
* `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).
1013

1114
The build file, `build.xml`, imports the build file from the OPL samples,
@@ -57,7 +60,29 @@ Once the driver is download and extracted, edit property `jdbc.connector.path` i
5760
to include the MySQL Connector/J `.jar` (should look like `mysql-connector-java-5.1.40-bin.jar`
5861
in your MySQL Connector/J extracted diretory)
5962

60-
Edit `data\db_mysql.xml` for your JDBC connection string and credentials.
63+
64+
Depending on the sample you run, you need to edit `build.properties` to make
65+
`mysql.jdbc.connector.path` point to your MySQL jdbc driver (i.e. mysql-connector-java-5.1.40-bin.jar).
66+
67+
On samples like [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat),
68+
you will need to edit your `.dat` so that the following line points to where your jdbc driver resides:
69+
70+
```
71+
IloOplImportJava("../../external_libs/mysql-connector-java-5.1.40-bin.jar")
72+
```
73+
74+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
75+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
76+
77+
```
78+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
79+
if (! jdbc_driver ) {
80+
jdbc_driver = "../../external_libs/mysql-connector-java-5.1.40-bin.jar"; // default for this project
81+
}
82+
```
83+
84+
85+
For sample [oil](examples/oil), edit `data\db_mysql.xml` for your JDBC connection string and credentials.
6186
Your connection string looks like `jdbc:mysql://localhost:3306/<database_name>?useSSL=false`
6287
where `<database_name>` is the name of your database (default is `custom_data_source`).
6388

README.SQLServer.md

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
## Build the sample
44

5-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5+
Samples [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat) and
6+
[studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
7+
section.
68

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+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
10+
11+
* `sqlserver.jdbc.connector.path` should point to your JDBC driver location.
912
* `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).
1013

1114
The build file, `build.xml`, imports the build file from the OPL samples,
@@ -20,26 +23,50 @@ The example is automatically compiled with the run Ant targets is invoked.
2023

2124
## Setup the sample database
2225

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+
To run the sample with MS SQL Server, you need to install Microsoft SQL Server.
27+
After it is installed, you are ready to setup the sample database.
2628

27-
Provided your sql server instance name is SQLEXPRESS, create database using:
29+
To create a sample database, open a <em>Commnad Prompt</em> window, and Provided your
30+
SQL Server instance name is SQLEXPRESS, create database using:
2831

2932
```
3033
C:\>sqlcmd -S .\SQLEXPRESS -i data\oil_mssql.sql
3134
```
3235

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)
36+
Before you run the sample, you need to download the [Microsoft JDBC Driver for SQL Server](https://docs.microsoft.com/fr-fr/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017).
37+
38+
Once your download finished, decompress the archive. The archive contains jar files that
39+
look like `mssql-jdbc-7.2.2.jre8.jar`.
40+
41+
42+
Depending on the sample you run, you need to edit `build.properties` to make
43+
`sqlserver.jdbc.connector.path` point to your MSSQL server jdbc driver (i.e. mssql-jdbc-7.2.2.jre8.jar).
44+
45+
On samples like [advanced_queries](examples/advanced_queries), [embedded_in_dat](examples/embedded_in_dat),
46+
you will need to edit your `.dat` so that the following line points to where your jdbc driver resides:
3547

36-
Edit `data\db_mssql.xml` for your JDBC connection string and credentials.
48+
```
49+
IloOplImportJava("../../external_libs/mssql-jdbc-7.2.2.jre8.jar")
50+
```
51+
52+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
53+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
54+
55+
```
56+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
57+
if (! jdbc_driver ) {
58+
jdbc_driver = "../../external_libs/mssql-jdbc-7.2.2.jre8.jar"; // default for this project
59+
}
60+
```
61+
62+
For sample [oil](examples/oil), edit `data\db_mssql.xml` for your JDBC connection string and credentials.
3763
Your connection string looks like ` jdbc:sqlserver://localhost;instanceName=<instance>;databaseName=<database_name>;integratedSecurity=true`
3864

3965
where `instance` is the mssql instance name (default is SQLEXPRESS), `<database_name>` is the name
4066
of your database (default is `custom_data_source`).
4167

42-
## Run the sample
68+
## Run the oil sample
69+
4370
Compile and run the sample for MS SQL Server:
4471

4572
```
@@ -48,4 +75,15 @@ $ ant run_mssql
4875

4976
* Uses data/oil.mod as a model file
5077
* Uses data/oil.dat as a data file
51-
* Uses data/db_db2.xml to customize the JDBC custom data source.
78+
* Uses data/db_mssql.xml to customize the JDBC custom data source.
79+
80+
## Other samples
81+
82+
The other samples do not need to be compiled, and will use `oplrun` executable. Each sample directory
83+
contains a convenience `run.bat` command line to run the sample. Otherwise you run them using the `run` target:
84+
85+
```
86+
$ ant run
87+
```
88+
89+

0 commit comments

Comments
 (0)