-
Notifications
You must be signed in to change notification settings - Fork 835
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
base: main
Are you sure you want to change the base?
Code sample - 23ai Vector Search with JDBC #353
Conversation
} | ||
|
||
private void insertVectorWithVarChar2(Connection connection) throws SQLException { | ||
PreparedStatement insertStatement = connection.prepareStatement(insertSql); |
There was a problem hiding this comment.
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>"; |
There was a problem hiding this comment.
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.
@Kuassim @jeandelavarene adjustment performed as requested - fix the indentation + try-with-resources. |
} | ||
|
||
private int randomize() { | ||
return ThreadLocalRandom.current().nextInt(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Signed-off-by: Juarez Barbosa [email protected]
@Kuassim @jeandelavarene please review and approve. Thanks!