.
├── LICENSE
├── README.md
├── lib
└── .keep
└── src
├── Demo
│ ├── Airport.java
│ └── Location.java
└── multimodelQS.java
For a guided tutorial using this sample, visit Accessing Data in Java Using Multiple Data Models on the InterSystems learning site.
This sample code shows object, relational, and native access from a Java application to InterSystems IRIS. Airport data is stored using objects and retrieved using SQL, and a custom data structure is created using globals to handle route information between airports.
-
Start with an installation of Java and a running instance of InterSystems IRIS.
-
Download the appropriate JDBC and XEP drivers for your system from the InterSystems Drivers Download page
-
Clone this repository and open it in your preferred IDE.
-
Add the drivers to the
lib
folder of this repo, or to your CLASSPATH according to the Connecting Your Application documentation page. -
In
multimodelQS.java
, on lines 29-32, change username, password, IP, port and namespace to point to your instance of InterSystems IRIS -
If you would like to see how to store data natively using Java, find and uncomment the following lines:
// storeAirfare(irisNative); // checkAirfare(irisNative);
-
Compile the project and run multimodelQS.java. If all works correctly, you will see a list of airports output. Data is stored using XEP (objects) and retrieved using JDBC (relationally).
- Enter departure airport: BOS
- Enter destination airport: AUS
The output should say:
Printed to ^airport global. The distance in miles between BOS and AUS is: 1698.
The following routes exist for this path:
-AA150: 450 USD
-AA290: 550 USDOther routes may be null.