Query Amazon RDS from kore.ai

chatbots

(Tamira Carey) #1

I have an Amazon RDS database set up that stores my data. I want to pull data from RDS into Kore to display the information in the form of a few graphs. Is there a document that can help me integrate RDS with Kore? It will use a SQL query to pull the data from RDS. I have developed the code below that should create a connection with RDS. Not sure how can this be implemented in Kore through a Service Request.

import groovy.json.JsonOutput

import groovy.json.JsonSlurper

import java.sql.ResultSet;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.sql.Connection;

import java.sql.DriverManager;

        ResultSet rs = null;

        Class.forName("com.mysql.jdbc.Driver");

                    String url = "rds_database_endpoint";

        Connection con = DriverManager.getConnection(url,"database_username","database_password");

        println("Connection is"+con.toString())

                    String query = 'sql_query'';

                    PreparedStatement statement = con.prepareStatement(query);

        rs = statement.executeQuery();

(Yoga Ramya Mendu) #2

Hi @tacarey,

You will need to expose your database through API’s and you can build the backend and generate the API which internally would do the query.

These API’s can be integrated in the service nodes.

Please refer the following document for more information on Service nodes:
https://developer.kore.ai/docs/bots/bot-builder-tool/dialog-task/working-with-the-service-node/

Also, kindly refer the below community post:

Regards,
Yoga Ramya.