Skip to content

PostgresProtocolPlugin not supporting Datasource Pooling #1325

@tariqdweik

Description

@tariqdweik

ArcadeDB Version:

ArcadeDB Server v23.10.1 (build 237a95c415ca75df9f16f0852eea55a76a9e94f7/1698808521864/main)

OS and JDK Version:

Windows 11 10.0 - OpenJDK 64-Bit Server VM 17.0.9 (Temurin-17.0.9+9)

Expected behavior

Server should accept connections originated from connection pools and/or created from datasources

Actual behavior

`Server is throwing the following exception

Unexpected message type '' for message any
com.arcadedb.postgres.PostgresProtocolException: Unexpected message type '' for message any
at com.arcadedb.postgres.PostgresNetworkExecutor.readMessage(PostgresNetworkExecutor.java:1006)
at com.arcadedb.postgres.PostgresNetworkExecutor.run(PostgresNetworkExecutor.java:131)
`

Steps to reproduce

`below is using dbcp2 library

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.commons.dbcp2.BasicDataSource;

public class ArcadeDBPoolingTest {
private static BasicDataSource dataSource;

private static BasicDataSource getDataSource() {

	if (dataSource == null) {
		BasicDataSource ds = new BasicDataSource();
		ds.setUrl("jdbc:postgresql://localhost/OpenBeer");
		ds.setUsername("root");
		ds.setPassword("admin123");

		ds.setMinIdle(5);
		ds.setMaxIdle(10);
		ds.setMaxOpenPreparedStatements(100);

		dataSource = ds;
	}
	return dataSource;
}

public static void main(String[] args) throws SQLException {

	try (BasicDataSource dataSource = ArcadeDBPoolingTest.getDataSource();
			Connection connection = dataSource.getConnection();
			PreparedStatement pstmt = connection.prepareStatement("SELECT 1");) {
		System.out.println("The Connection Object is of Class: " + connection.getClass());
		try (ResultSet resultSet = pstmt.executeQuery();) {
			while (resultSet.next()) {
				System.out.println(resultSet.getInt(1));
			}
		} catch (Exception e) {
			connection.rollback();
			e.printStackTrace();
		}
	}
}

}
`

The same result is when using HikariCP and Tomcat Pooling libraries

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions