The InterSystems JDBC driver supports three lightweight Java APIs that provide direct access to InterSystems IRIS® databases via relational tables, objects, or multidimensional storage.
Java features available in InterSystems IRIS include:
Watch the video or try the exercise below.
With Java, you can interact with InterSystems IRIS relationally (with JDBC), using objects (with XEP), or natively (with the Native API). In the steps below, you will access a set of sample stock data using each of the ways described.
cd /home/project git clone -b try-iris https://github.com/intersystems/quickstarts-java
config.txt
file and change the value of IP
to -- cannot display value - please provision a sandbox and the value of port
to -- cannot display value - please provision a sandbox.Use the standard JDBC API for SQL-based access to relational tables.
jdbcplaystocksTask7.java
to view the JDBC code. You will notice the connection string uses these variables to connect:String dbUrl = protocol + ip + ":" + port + "/" + namespace;
jdbcplaystocksTask7.java
:cd /home/project/quickstarts-java/src javac -cp ".:../lib/intersystems-jdbc-3.2.0.jar" jdbcplaystocksTask7.java java -cp ".:../lib/intersystems-jdbc-3.2.0.jar" jdbcplaystocksTask7
Use XEP for high-performance, real-time object insertions.
xepplaystocksTask6.java
to view the XEP code. You will notice the connection string uses these variables to connect: xepPersister.connect(ip, port, namespace, username, password);
xepplaystocksTask6.java
:cd /home/project/quickstarts-java/src javac -cp ".:../lib/intersystems-jdbc-3.2.0.jar:../lib/intersystems-xep-3.2.0.jar" xepplaystocksTask6.java java -cp ".:../lib/intersystems-jdbc-3.2.0.jar:../lib/intersystems-xep-3.2.0.jar" xepplaystocksTask6
With XEP, you can efficiently stores objects directly to InterSystems IRIS, requiring no translation to rows.
Use the Native API to store to a custom structure and call methods or routines.
native
playstocksTask5.java
to view the Native API code. You will notice the connection string uses these variables to connect: String dbUrl = protocol + ip + ":" + port + "/" + namespace;
. Notice this code uses the standard JDBC connection.nativeplaystocksTask5.java
:cd /home/project/quickstarts-java/src javac -cp ".:../lib/intersystems-jdbc-3.2.0.jar" nativeplaystocksTask5.java java -cp ".:../lib/intersystems-jdbc-3.2.0.jar" nativeplaystocksTask5
With the Native API, you can efficiently store data in your own custom data structure, allowing you to answer questions you could not answer using tables or objects. Additionally, you can call class methods and routines from within InterSystems IRIS using the Native API.
Use JDBC, XEP, and Native access side by side, choosing the best model for each task.
multimodelplaystocksTask4.java
to see how all APIs work together. You will notice the connection string uses these variables to connect: xepPersister.connect(ip, port, namespace, username, password);
multimodelplaystocksTask4.java
:cd /home/project/quickstarts-java/src javac -cp ".:../lib/intersystems-jdbc-3.2.0.jar:../lib/intersystems-xep-3.2.0.jar" multimodelplaystocksTask4.java java -cp ".:../lib/intersystems-jdbc-3.2.0.jar:../lib/intersystems-xep-3.2.0.jar" multimodelplaystocksTask4
With InterSystems IRIS, you can use one connection and use the method that is best for each task, decreasing the time it takes to develop your applications while also increasing your application performance. XEP efficiently stores objects directly to InterSystems IRIS, requiring no translation to rows. It is worth mentioning that JDBC can also be used now to retrieve the data stored using XEP, reducing data redundancy.
To give you the best possible experience, this site uses cookies and by continuing to use the site you agree that we can save them on your device.