Just decided to do a followup on Adding MariaDB JDBC Connector to Payara 51.
I wanted to see if it was possibly very easy to do this using the command line.
Installing a MariaDB driver
$ ./asadmin add-library /home/mrbear/software/mariadb-java-client-2.3.0.jar
Command add-library executed successfully.
Command add-library executed successfully.
Creating a new JDBC Connection pool
The syntax:
Usage: asadmin [asadmin-utility-options] create-jdbc-connection-pool
[--datasourceclassname] [--restype ]
[--steadypoolsize]
[--maxpoolsize]
[--maxwait]
[--poolresize]
[--idletimeout] [--initsql ]
[--isolationlevel]
[--isisolationguaranteed[=]]
[--isconnectvalidatereq[=]]
[--validationmethod]
[--validationtable]
[--failconnection[=]]
[--allownoncomponentcallers[=]]
[--nontransactionalconnections[=]]
[--validateatmostonceperiod]
[--leaktimeout]
[--leakreclaim[=]]
[--creationretryattempts]
[--creationretryinterval]
[--sqltracelisteners]
[--statementtimeout]
[--statementleaktimeout]
[--statementleakreclaim[=]]
[--lazyconnectionenlistment[=]]
[--lazyconnectionassociation[=]]
[--associatewiththread[=]]
[--driverclassname]
[--matchconnections[=]]
[--maxconnectionusagecount]
[--ping[=]] [--pooling[=]]
[--statementcachesize]
[--validationclassname]
[--wrapjdbcobjects[=]]
[--description] [--property ]
[-?|--help[=]] jdbc_connection_pool_id
[--datasourceclassname
[--steadypoolsize
[--maxpoolsize
[--maxwait
[--poolresize
[--idletimeout
[--isolationlevel
[--isisolationguaranteed[=
[--isconnectvalidatereq[=
[--validationmethod
[--validationtable
[--failconnection[=
[--allownoncomponentcallers[=
[--nontransactionalconnections[=
[--validateatmostonceperiod
[--leaktimeout
[--leakreclaim[=
[--creationretryattempts
[--creationretryinterval
[--sqltracelisteners
[--statementtimeout
[--statementleaktimeout
[--statementleakreclaim[=
[--lazyconnectionenlistment[=
[--lazyconnectionassociation[=
[--associatewiththread[=
[--driverclassname
[--matchconnections[=
[--maxconnectionusagecount
[--ping[=
[--statementcachesize
[--validationclassname
[--wrapjdbcobjects[=
[--description
[-?|--help[=
Note the following:
- The escape character backslash (\) is used in the --property option to distinguish the semicolon (;).
- Two backslashes (\\) are used to distinguish the equal sign (=).
- Two backslashes (\\) are used to distinguish the colon (:).
./asadmin create-jdbc-connection-pool --driverclassname org.mariadb.jdbc.Driver --restype java.sql.Driver --property databaseName=mmud:password=topsecretpassword:user=root:URL=jdbc\\:mariadb\\://localhost\\:3306/mmud:serverName=localhost mmudpool
Let's test it!
./asadmin ping-connection-pool mmudpool
In case you wish to delete it, try:
./asadmin delete-jdbc-connection-pool mmudpool
Creating the JNDI
./asadmin create-jdbc-resource --connectionpoolid mmudpool jdbc/mmud
References
- [1] Adding MariaDB JDBC Connector to Payara 5
- https://randomthoughtsonjavaprogramming.blogspot.com/2018/12/adding-mariadb-jdbc-connector-to-paraya.html
- [2] Payara Blog - An intro to connection pools in payar server 5
- https://blog.payara.fish/an-intro-to-connection-pools-in-payara-server-5
No comments:
Post a Comment