Shade MariaDB driver & add configurable driver class to config
This commit is contained in:
parent
4fd654c743
commit
d57b921b4f
8
pom.xml
8
pom.xml
@ -80,5 +80,13 @@
|
|||||||
<version>2.5.3</version>
|
<version>2.5.3</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
<version>2.7.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -77,6 +77,8 @@ public final class SkriptDB extends JavaPlugin {
|
|||||||
out.write("# How many connections can be awaited for simultaneously, may be useful to increase if mysql database is hosted on a separate machine to account for ping.\n");
|
out.write("# How many connections can be awaited for simultaneously, may be useful to increase if mysql database is hosted on a separate machine to account for ping.\n");
|
||||||
out.write("# If it is hosted within the same machine, set it to the count of cores your processor has or the count of threads your processor can process at once.\n");
|
out.write("# If it is hosted within the same machine, set it to the count of cores your processor has or the count of threads your processor can process at once.\n");
|
||||||
out.write("thread-pool-size: " + (Runtime.getRuntime().availableProcessors() + 1) + "\n");
|
out.write("thread-pool-size: " + (Runtime.getRuntime().availableProcessors() + 1) + "\n");
|
||||||
|
out.write("# Only change this if you wish to use a different driver than Java's default, like MariaDB driver.\n");
|
||||||
|
out.write("sql-driver-class-name:" + "\"default\"" + "\n");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.btk5h.skriptdb.skript;
|
package com.btk5h.skriptdb.skript;
|
||||||
|
|
||||||
|
import com.btk5h.skriptdb.SkriptDB;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -56,6 +57,11 @@ public class ExprDataSource extends SimpleExpression<HikariDataSource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HikariDataSource ds = new HikariDataSource();
|
HikariDataSource ds = new HikariDataSource();
|
||||||
|
|
||||||
|
//allow specifying of own sql driver class name
|
||||||
|
if (!SkriptDB.getInstance().getConfig().getString("sql-driver-class-name").equals("default")) {
|
||||||
|
ds.setDriverClassName(SkriptDB.getInstance().getConfig().getString("sql-driver-class-name"));
|
||||||
|
}
|
||||||
ds.setJdbcUrl(jdbcUrl);
|
ds.setJdbcUrl(jdbcUrl);
|
||||||
|
|
||||||
if (maxLifetime != null) {
|
if (maxLifetime != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user