Java Application - JDBC Connection to AO Platform and Easy Answers
Intended audience: DEVELOPERS ADMINISTRATORS
AO Platform: 4.3
Overview
This topic provides insight into how to access the AO Platform Ontology and Easy Answers from a Java application - using Spring Boot.
This integration should be considered a Preview in the 4.3 release. More functionality is expected to become available in future releases.
Installation and Configuration
Video
Code
plugins {
// Apply the Java plugin so that 'implementation' configuration is available
id 'java'
// Spring Boot plugin (adjust version as needed)
id 'org.springframework.boot' version '2.7.15'
// Spring's recommended dependency-management plugin
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'com.apporchid'
version = '0.0.1-SNAPSHOT'
// Java language level (adjust as appropriate)
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
dependencies {
// Keep your normal Spring Boot logging (Logback)
implementation 'org.springframework.boot:spring-boot-starter-web'
// Spring Boot JDBC (provides JdbcTemplate, DataSource auto-config, etc.)
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
// Avatica JDBC driver (exclude conflicting SLF4J bindings)
implementation('org.apache.calcite.avatica:avatica:1.21.0') {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'org.slf4j', module: 'slf4j-nop'
}
// Guava (used for Preconditions, Strings, etc.)
implementation 'com.google.guava:guava:32.1.2-jre'
// For unit testing
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
// If you need a specific main class to run, set it here:
springBoot {
mainClass = 'com.apporchid.drivers.AoPlatformJdbcApplication'
}
tasks.named('test') {
useJUnitPlatform()
}
Resources
AO Platform Spring JDBC
AO Platform JDBC