Skip to content

Instantly share code, notes, and snippets.

View juarezjuniorgithub's full-sized avatar

Juarez Barbosa Junior juarezjuniorgithub

View GitHub Profile
@juarezjuniorgithub
juarezjuniorgithub / hibernate-vector-oracle-ai-vector-search-functions.md
Last active March 10, 2025 13:01
Functions - Hibernate Vector module and Oracle AI Vector Search
Function Specification
cosine_distance() Computes the cosine distance between two vectors. It maps to vector_distance(v1, v2, COSINE) function of Oracle AI Vector Search.
l1_distance() Alias for the taxicab_distance() function below.
taxicab_distance() Computes the taxicab distance between two vectors. It maps aps to vector_distance(v1, v2, MANHATTAN) function for Oracle AI Vector Search.
l2_distance() Alias for the euclidean_distance() function below.
euclidean_distance() Computes the euclidean distance between two vectors. It maps to vector_distance(v1, v2, EUCLIDEAN) function of Oracle AI Vector Search.
inner_product() Computes the inner product between two vectors. It maps to the
@juarezjuniorgithub
juarezjuniorgithub / SQLStatementWithAsynchronousJDBC.java
Created March 6, 2025 13:50
SQLStatementWithAsynchronousJDBC.java
/*
Copyright (c) 2024, Oracle and/or its affiliates.
This software is dual-licensed to you under the Universal Permissive License
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
either license.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@juarezjuniorgithub
juarezjuniorgithub / default_embedding_table_columns.md
Last active February 25, 2025 13:54
Default embedding table columns - OracleEmbeddingStore
Name Type Description
id VARCHAR(36) Primary key. Used to store UUID strings which are generated when the embedding store
embedding VECTOR(*, FLOAT32) Stores the embedding
text CLOB Stores the text segment
metadata JSON Stores the metadata
@juarezjuniorgithub
juarezjuniorgithub / PipelineVectorDemo.java
Created November 12, 2024 11:05
PipelineVectorDemo.java
/*
Copyright (c) 2024, Oracle and/or its affiliates.
This software is dual-licensed to you under the Universal Permissive License
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
either license.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@juarezjuniorgithub
juarezjuniorgithub / OracleAIVectorSearchWithJava.java
Created May 23, 2024 08:18
OracleAIVectorSearchWithJava.java
/*
Copyright (c) 2024, Oracle and/or its affiliates.
This software is dual-licensed to you under the Universal Permissive License
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
either license.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
@juarezjuniorgithub
juarezjuniorgithub / application.properties
Created January 18, 2024 14:03
Oracle Autonomous Database connection details
spring.datasource.url=<YOUR_JDBC_CONNECTION_URL>
spring.datasource.username=<YOUR_DB_USERNAME>
spring.datasource.password=<YOUR_DB_PASSWORD>
@juarezjuniorgithub
juarezjuniorgithub / application.properties
Created January 18, 2024 14:01
Properties for UCP - Universal Connection Pool (UCP). Spring Boot 2.4.0 or above is required - application.properties
spring.datasource.type=oracle.ucp.jdbc.PoolDataSource
spring.datasource.oracleucp.connection-pool-name=connectionPoolName1
spring.datasource.oracleucp.initial-pool-size=1
spring.datasource.oracleucp.min-pool-size=1
spring.datasource.oracleucp.max-pool-size=2
spring.datasource.oracleucp.connection-factory-class-name=oracle.jdbc.pool.OracleDataSource
@juarezjuniorgithub
juarezjuniorgithub / Pool metrics mappings.csv
Created January 17, 2024 13:24
Pool metrics mappings
HikariCP metrics UCP Metrics
Number of active connections BorrowedConnectionsCount
Number of pending connection requests PendingRequestsCount
Total number of timed-out requests CumulativeFailedConnectionWaitCount
Time taken to get a connection PeakConnectionWaitTime / AverageConnectionWaitTime
Current total number of connections TotalConnectionsCount
Number of idle connections AvailableConnectionsCount
Max number of connections PeakConnectionsCount
@juarezjuniorgithub
juarezjuniorgithub / UCP knobs that don't exist in Hikari.csv
Last active January 19, 2024 08:59
UCP knobs that don't exist in Hikari
UCP Knob Description
UCP[XA]ConnectionBuilder.user().password() or PoolDataSource.getConnection(user + password) UCP's single pool can hold connections from more than one database accounts and can borrow a connection to a given account.
UCP[XA]ConnectionBuilder.shardingKey().superShardingKey() It is possible to establish a connection with a given sharding key/super key.
UCP[XA]ConnectionBuilder.connectionWaitTimeout() or UCP[XA]ConnectionBuilder.connectionWaitDuration() UCP can set connection wait timeout (either in seconds or in Duration - supporting milliseconds) for a separate borrow request as well as for a whole PoolDataSource.
UCP[XA]ConnectionBuilder.service() It is possible to borrow a connection to a selected database service (a pool can hold connections from different services.
UCP[XA]ConnectionBuilder..labels() or PoolDataSource.getConnection(labels) UCP connections can be labeled and per-label connection cost can be assigned. Then a connection can be borrowed based on its label(s) and cost.
@juarezjuniorgithub
juarezjuniorgithub / HikariCP properties that don’t have identical UCP properties to match but do have other mechanisms like driver properties or UCP APIs.csv
Last active January 17, 2024 17:00
HikariCP properties that don’t have identical UCP properties to match but do have other mechanisms like driver properties or UCP APIs
HikariCP Comments
autoCommit Use Oracle JDBC driver connection property autoCommit.
registerMbeans UCP always attempts registration.
threadFactory UCP supports setTaskManager instead (setter API only).
scheduledExecutor UCP supports setTaskManager instead (setter API only).
keepaliveTime Closest is to use driver connection properties oracle.net.keepAlive + oracle.net.TCP_KEEPIDLE which apply to all connections borrowed/available. The HikariCP property applies only to idle/available connections and uses isValid/query to keep alive. Another option is to add async validation in UCP for available connections.
minimumIdle Controls the minimum number of idle connections HikariCP tries to maintain in the pool.