Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AOSS remote cluster connection configuration support #125

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

manasvinibs
Copy link
Member

@manasvinibs manasvinibs commented Oct 2, 2024

Description

Build changes by running

./gradlew shadowJar

Sample test url - jdbc:opensearch://https://ruh7jos10anqd6bsp844.beta-us-east-1.aoss.amazonaws.com?auth=aws_sigv4_serverless&region=us-east-1

Sample Main.java class for JDBC Driver stand-alone application -

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Main {
    public static void main(String[] args) {
        String url = "jdbc:opensearch://https://ruh7jos10anqd6bsp844.beta-us-east-1.aoss.amazonaws.com?auth=aws_sigv4_serverless&region=us-east-1";
        try {

            Connection con = DriverManager.getConnection(url);
            Statement st = con.createStatement();

            ResultSet rs = st.executeQuery("SELECT * FROM target_index");
            System.out.println("**************** Execute Query: SELECT * FROM target_index");
            System.out.println("**************** Result set *****************");

            // Get the ResultSet metadata
            java.sql.ResultSetMetaData rsmd = rs.getMetaData();
            int columnsNumber = rsmd.getColumnCount();

            while (rs.next()) {

                for (int i = 1; i <= columnsNumber; i++) {
                    if (i > 1) System.out.print(",  ");
                    String columnValue = rs.getString(i);
                    System.out.print(rsmd.getColumnName(i) + ": " + columnValue);
                }
            }
        } catch (Exception e) {
            System.out.println("Exception :" + e.getMessage());
            e.printStackTrace();
        }
    }
}

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Manasvini B S <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants