Connect to external systems and database with the generic JDBC driver. This acts as a wrapper for the REST - Search operation.
The Advanced or Premium edition of is required to use REST and the JDBC driver. |
This driver can be used in any application. It only supports SELECT SQL operations.
You can access the current version of the driver here: https://download.agiloft.com/public/agiloft-jdbc-driver.jar
The driver has these settings:
Where the parameters are:
For example, you might use: jdbc:agiloft:schema.https=true;schema.loginDomain=sandbox2.agiloft.com;schema.kb=Demo;schema.user=admin;schema.password=qwerty
For subtables, the table name must be placed inside quotation marks (""). Post-processing of query conditions is done using Apache Calcite. Make sure to measure acceptable performance early, especially if you use operators, Calcite functions, or a combination of the two. Note that this post-processing does not support fields whose logical name begins with an underscore (_), and if you have any such fields, you need to transfer their contents to a supported field in order to use this method. |
This example driver is used in the following Java sample program:
public class driverUsecase { public static void main(String[] args) throws SQLException { String url = "jdbc:agiloft:schema.https=true;schema.loginDomain=sandbox2.agiloft.com;schema.kb=Demo;schema.user=admin;schema.password=qwerty"; Connection connection = driverManager.getConnection(url); String sql = "select count(*) from company"; PreparedStatement statement = connection.prepareStatement(sql); ResultSet rs = statement.executeQuery(); while (rs.next()) { int value = rs.getInt(1); System.out.println("count(*) of company = " + value); } } } |
Here's an example using Python instead:
import os import jaydebeapi def run_sql(sql): '''Sample function to run SQL query''' driver_class = 'com.agiloft.jdbc.adapter.AgiloftDriver' jar_file = 'C:\\agiloft-jdbc-driver.jar' jdbc_url = ("jdbc:agiloft:schema.https=false;schema.loginDomain=sandbox2.agiloft.com;" "schema.kb=Demo;schema.user=admin;schema.password=qwerty") conn = jaydebeapi.connect(jclassname=driver_class, url=jdbc_url, jars=jar_file) cursor = conn.cursor() cursor.execute(sql) return cursor.fetchall() company_count = run_sql("select count(*) from company")[0][0] print("Total companies = %s" % (company_count,)) |
Related articles |