[CONJ-806] Cannot find symbol: MariaDbPoolDataSource Created: 2020-07-07  Updated: 2021-05-17  Resolved: 2021-05-17

Status: Closed
Project: MariaDB Connector/J
Component/s: pooling
Affects Version/s: 2.6.1
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Richard Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Centos 6



 Description   

DriverManager.getConnection works perfectly. Way better performance than old mysql driver

But I am struggling with your pool code example:

https://mariadb.com/kb/en/pool-datasource-implementation/

MariaDbPoolDataSource pool = new MariaDbPoolDataSource("jdbc:mariadb://server/db?user=myUser&maxPoolSize=10");

try (Connection connection = pool.getConnection()) {
try (Statement stmt = connection.createStatement())

{ ResultSet rs = stmt.executeQuery("SELECT CONNECTION_ID()"); rs.next(); System.out.println(rs.getLong(1)); //4489 }

}

I have these imports:
import java.sql.*;
import javax.sql.*;

I compile as normal, but get this error:

javac select_con_mdb_ds_pool.java
select_con_mdb_ds_pool.java:46: error: cannot find symbol
MariaDbPoolDataSource pool = new MariaDbPoolDataSource("jdbc:mariadb://192.168.1.155?user=xxx&password=yy&maxPoolSize=10");
^
symbol: class MariaDbPoolDataSource
location: class select_con_mdb_ds_pool
select_con_mdb_ds_pool.java:46: error: cannot find symbol
MariaDbPoolDataSource pool = new MariaDbPoolDataSource("jdbc:mariadb://192.168.1.155?user=xxx&password=yy&maxPoolSize=10");
^
symbol: class MariaDbPoolDataSource
location: class select_con_mdb_ds_pool
2 errors

I'm probably doing something stupid - any help would be appreciated!



 Comments   
Comment by Diego Dupin [ 2020-11-17 ]

You have to import MariaDbPoolDataSource:

import org.mariadb.jdbc.MariaDbPoolDataSource;

sorry for late answer.

Generated at Thu Feb 08 03:18:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.