-
Notifications
You must be signed in to change notification settings - Fork 8
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
Issues with Aerospike JDBC Driver: Connection Error and Statement Closure #74
Comments
Hi @pavandonade,
To test the fixes, you can build and install the driver locally. Feel free to reach out if you have any questions or encounter any issues. |
Hi @reugn Unfortunately, I am still encountering the IllegalArgumentException after testing the driver built with these changes. The issue arises under the following specific conditions: Scenario 1: Aerospike Driver Loaded First When the Aerospike JDBC driver is loaded before the Oracle JDBC driver using Class.forName(), and then a connection to the Oracle database is attempted, the following sequence triggers the exception: Class.forName("com.aerospike.jdbc.AerospikeDriver"); Connection oracleConn = DriverManager.getConnection(oraUrl, "username", "password"); This results in: Exception in thread "main" java.lang.IllegalArgumentException: Cannot parse URL jdbc:oracle:thin:@192.168.xxx.xxx:1521:orcl Scenario 2: Oracle Driver Loaded First However, when the driver loading order is reversed, with the Oracle JDBC driver loaded before the Aerospike driver, the connections are successful: Class.forName("oracle.jdbc.driver.OracleDriver"); Connection oracleConn = DriverManager.getConnection(oraUrl, "username", "password"); This indicates that the Aerospike driver might be incorrectly attempting to parse the Oracle JDBC URL, despite the intended fix in FMWK-587. Additional Observation: I have also observed that aerospikeStatement.isClosed() consistently returns false even after explicitly calling aerospikeStatement.close() within a finally block. This behavior is unexpected, as the finally block guarantees execution, and no exceptions occur during the statement closure. Environment Details: Aerospike JDBC Driver version: uber-aerospike-jdbc-1.9.1.jar |
@pavandonade, please use the locally built driver from the main branch, not the released version 1.9.1. |
Hi @reugn That worked perfectly! Thanks for pointing me to the main branch driver. It seems the released version (1.9.1) was causing the issue. I appreciate the quick and accurate solution. Now I'm facing a situation where the program doesn't terminate even after fetching and closing all resource correctly. It should terminate main program after execution. Any suggestions would be appreciated. |
To close the global client's |
Hello @reugn, |
Version 1.9.2 has been released. |
Description
I'm encountering a couple of issues while using the Aerospike JDBC driver in my application. I would appreciate any guidance or solutions to these problems.
When I attempt to establish a connection to the Aerospike database using DriverManager.getConnection(), I receive an IllegalArgumentException if the Aerospike driver is prioritized with Class.forName("com.aerospike.jdbc.AerospikeDriver"). The error message is:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot parse URL jdbc:oracle:thin:@192.168.xxx.xxx:1521:xyz
at com.aerospike.jdbc.util.URLParser.parseHosts(URLParser.java:128)
at com.aerospike.jdbc.util.URLParser.parseUrl(URLParser.java:82)
at com.aerospike.jdbc.AerospikeConnection.(AerospikeConnection.java:39)
at com.aerospike.jdbc.AerospikeDriver.connect(AerospikeDriver.java:25)
at java.sql.DriverManager.getConnection(DriverManager.java:681)
at java.sql.DriverManager.getConnection(DriverManager.java:229)
at com.icedq.aerospike.OracleMain.main(OracleMain.java:29)
It seems that the Aerospike driver is attempting to parse a connection URL intended for Oracle. How can I resolve this conflict when working with multiple database drivers?
While connecting to the Aerospike database, I've observed that java.sql.Statement does not close properly, even after calling statement.close(); in a finally block. When we call statement.isClosed() after closing the statement it returns false. This behavior raises concerns about resource management. Any recommendations on how to ensure statements are correctly closed would be greatly appreciated.
Environment
Aerospike JDBC Driver version: [aerospike-jdbc-1.9.1.jar + its compile time dependencies],
Aerospike JDBC Driver version: uber-aerospike-jdbc-1.7.4.jar
Note: We have tried both the jars
Java version: Java 17
Database: Aerospike
I have attached main program for your reference -
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class OracleMain {
}
The text was updated successfully, but these errors were encountered: