You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.DB2.md
+31-6Lines changed: 31 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,11 @@
2
2
3
3
## Build the sample
4
4
5
-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5
+
Sample [studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
6
+
section.
7
+
8
+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
6
9
7
-
* If you want to run the sample with MySQL, `mysql.jdbc.connector.path` should point to your JDBC driver location.
8
10
* If you want to run the sample with IBM DB2, `db2.jdbc.connector.path` should point to your JDBC driver location.
9
11
*`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
12
@@ -38,19 +40,34 @@ Run the following SQL script to create and populate the example database:
38
40
db2 -tvmf data/oil_db2.sql
39
41
```
40
42
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
43
44
44
You can download the DB2 jdbc driver [here](http://www-01.ibm.com/support/docview.wss?uid=swg21363866).
45
45
Note that if you installed DB2 Express-C, your JDBC driver is `db2jcc4.jar`
46
46
in `<DB2 installdir>/SQLLIB/java`.
47
47
48
-
Edit `data\db_db2.xml` for your JDBC connection string and credentials.
48
+
Depending on the sample you run, you need to edit, `build.properties` to make `db2.jdbc.connector.path` point
49
+
to your DB2 jdbc driver.
50
+
51
+
Depending on the sample you run, you need to edit `build.properties` to make
52
+
`db2.jdbc.connector.path` point to your DB2 jdbc driver (i.e. db2jcc4.jar).
53
+
54
+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
55
+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
56
+
57
+
```
58
+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
59
+
if (! jdbc_driver ) {
60
+
jdbc_driver = "../../external_libs/db2jcc4.jar"; // default for this project
61
+
}
62
+
```
63
+
64
+
For sample [oil](examples/oil), edit `data\db_db2.xml` for your JDBC connection string and credentials.
49
65
Your connection string looks like `db2://localhost:<port>/<database_name>`
50
66
where `port` is the DB2 port (default is 50000), `<database_name>` is the name
51
67
of your database (default is `CUSTOMDB`).
52
68
53
-
## Run the sample
69
+
## Run the oil sample
70
+
54
71
Compile and run the sample for IBM DB2:
55
72
56
73
```
@@ -61,4 +78,12 @@ $ ant run_db2
61
78
* Uses data/oil.dat as a data file
62
79
* Uses data/db_db2.xml to customize the JDBC custom data source.
63
80
81
+
## Other samples
82
+
83
+
The other samples do not need to be compiled, and will use `oplrun` executable. Each sample directory
84
+
contains a convenience `run.bat` command line to run the sample. Otherwise you run them using the `run` target:
Copy file name to clipboardExpand all lines: README.MySQL.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,12 @@
2
2
3
3
## Build the sample
4
4
5
-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5
+
Sample [studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
6
+
section.
7
+
8
+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
6
9
7
10
* 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
11
*`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
12
11
13
The build file, `build.xml`, imports the build file from the OPL samples,
@@ -57,7 +59,23 @@ Once the driver is download and extracted, edit property `jdbc.connector.path` i
57
59
to include the MySQL Connector/J `.jar` (should look like `mysql-connector-java-5.1.40-bin.jar`
58
60
in your MySQL Connector/J extracted diretory)
59
61
60
-
Edit `data\db_mysql.xml` for your JDBC connection string and credentials.
62
+
63
+
Depending on the sample you run, you need to edit `build.properties` to make
64
+
`mysql.jdbc.connector.path` point to your MySQL jdbc driver (i.e. mysql-connector-java-5.1.40-bin.jar).
65
+
66
+
67
+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
68
+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
69
+
70
+
```
71
+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
72
+
if (! jdbc_driver ) {
73
+
jdbc_driver = "../../external_libs/mysql-connector-java-5.1.40-bin.jar"; // default for this project
74
+
}
75
+
```
76
+
77
+
78
+
For sample [oil](examples/oil), edit `data\db_mysql.xml` for your JDBC connection string and credentials.
61
79
Your connection string looks like `jdbc:mysql://localhost:3306/<database_name>?useSSL=false`
62
80
where `<database_name>` is the name of your database (default is `custom_data_source`).
Copy file name to clipboardExpand all lines: README.SQLServer.md
+42-12Lines changed: 42 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,12 @@
2
2
3
3
## Build the sample
4
4
5
-
Before you build the sample, you must edit `build.properties` for the appropriate path locations:
5
+
Sample [studio_integration](examples/studio_integration) do not need to be compiled, so you can skip this
6
+
section.
6
7
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.
8
+
Before you build the [oil](examples/oil) sample, you must edit `build.properties` for the appropriate path locations:
9
+
10
+
*`sqlserver.jdbc.connector.path` should point to your JDBC driver location.
9
11
*`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
12
11
13
The build file, `build.xml`, imports the build file from the OPL samples,
@@ -20,26 +22,43 @@ The example is automatically compiled with the run Ant targets is invoked.
20
22
21
23
## Setup the sample database
22
24
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:
25
+
To run the sample with MS SQL Server, you need to install Microsoft SQL Server.
26
+
After it is installed, you are ready to setup the sample database.
26
27
27
-
Provided your sql server instance name is SQLEXPRESS, create database using:
28
+
To create a sample database, open a <em>Commnad Prompt</em> window, and Provided your
29
+
SQL Server instance name is SQLEXPRESS, create database using:
28
30
29
31
```
30
32
C:\>sqlcmd -S .\SQLEXPRESS -i data\oil_mssql.sql
31
33
```
32
34
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
+
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).
36
+
37
+
Once your download finished, decompress the archive. The archive contains jar files that
38
+
look like `mssql-jdbc-7.2.2.jre8.jar`.
39
+
40
+
41
+
Depending on the sample you run, you need to edit `build.properties` to make
42
+
`sqlserver.jdbc.connector.path` point to your MSSQL server jdbc driver (i.e. mssql-jdbc-7.2.2.jre8.jar).
43
+
44
+
In sample [studio_integration](examples/studio_integration), you will need to edit `jdbc.js` to point
45
+
to your jdbc driver, *or* add an `OPL_JDBC_DRIVER` environment variable pointing to it:
46
+
47
+
```
48
+
var jdbc_driver = IloOplGetEnv("OPL_JDBC_DRIVER");
49
+
if (! jdbc_driver ) {
50
+
jdbc_driver = "../../external_libs/mssql-jdbc-7.2.2.jre8.jar"; // default for this project
51
+
}
52
+
```
35
53
36
-
Edit`data\db_mssql.xml` for your JDBC connection string and credentials.
54
+
For sample [oil](examples/oil), edit`data\db_mssql.xml` for your JDBC connection string and credentials.
37
55
Your connection string looks like ` jdbc:sqlserver://localhost;instanceName=<instance>;databaseName=<database_name>;integratedSecurity=true`
38
56
39
57
where `instance` is the mssql instance name (default is SQLEXPRESS), `<database_name>` is the name
40
58
of your database (default is `custom_data_source`).
41
59
42
-
## Run the sample
60
+
## Run the oil sample
61
+
43
62
Compile and run the sample for MS SQL Server:
44
63
45
64
```
@@ -48,4 +67,15 @@ $ ant run_mssql
48
67
49
68
* Uses data/oil.mod as a model file
50
69
* Uses data/oil.dat as a data file
51
-
* Uses data/db_db2.xml to customize the JDBC custom data source.
70
+
* Uses data/db_mssql.xml to customize the JDBC custom data source.
71
+
72
+
## Other samples
73
+
74
+
The other samples do not need to be compiled, and will use `oplrun` executable. Each sample directory
75
+
contains a convenience `run.bat` command line to run the sample. Otherwise you run them using the `run` target:
IloOplDataSource jdbcDataSource = new JdbcCustomDataSource(jdbcProperties, oplF, def);
112
-
// Pass it to the model.
113
-
opl.addDataSource(jdbcDataSource);
114
-
}
115
-
```
116
66
117
67
## Export plain dat files
118
68
* When running the `ant` command with the DB2/mysql target, simply add `-Dexport=result.dat` on the command line, and it will export all the tuplesets that have been extracted from the database to `result.dat` file.
0 commit comments