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

Code sample - 23ai Vector Search with JDBC #353

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

juarezjuniorgithub
Copy link
Member

Signed-off-by: Juarez Barbosa [email protected]
@Kuassim @jeandelavarene please review and approve. Thanks!

}

private void insertVectorWithVarChar2(Connection connection) throws SQLException {
PreparedStatement insertStatement = connection.prepareStatement(insertSql);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use try with resources in such methods as this code as-is leaks cursors (the statement isn't closed).


public class OracleAIVectorSearchWithJava {

private final static String URL = "<JDBC_CONNECTION_URL>";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use 2 space chars for padding.

@juarezjuniorgithub
Copy link
Member Author

juarezjuniorgithub commented Jul 1, 2024

@Kuassim @jeandelavarene adjustment performed as requested - fix the indentation + try-with-resources.
Please review/approve. Thanks.

}

private int randomize() {
return ThreadLocalRandom.current().nextInt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define ID as
NUMBER GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1)
and avoid using a random number for your primary key.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as requested - added NUMBER GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1),
modified the Java JDBC code, and removed the randomize() method. @Kuassim, please review; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants