miércoles, 10 de mayo de 2017

Configurar jdbcConnectionPool MySQL Glassfish

En una version anterior a glassfish 4.1.1 no me permitia modificar/configurar conection pool de jdbc, en su administrador web del glassfish, simplemente tronaba, se soluciona haciendo el trabajo desde linea de comandos en el asadmin de glassfish


Glassfish Server
glassfish manual and javaee7tutorial manual

== start server ===
asadmin start-domain --verbose

glassfish server port number: default 8080
administrator server's port number: default 4848
administrator user name and password: username admin no password

output also go to the server log:
domain-dir/logs/server.log

== stop server ==
asadmin stop-domain domain1

== start admin console ==
http://localhost:4848/.

== start/stop the java DB Server ==
asadmin start-database
asadmin stop-database

http://www.oracle.com/technetwork/java/javadb/overview/index.html.

== glassfish Create resources administratively ===
asadmin add-resources glassfish-resources.xml




Configuracion de Recursos DataSource, ConnectionPoolDataSource

asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property User=[db_username]:Port=3306:Password=[db_password]:Url="jdbc:mysql://[localhost or ip]:3306/[db_name]" [pool_name]

example

./asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property User=admin:Port=3306:Password=admin:Url="jdbc:mysql://127.0.0.1:3306/\test" test_pool

on practice

./asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property User=root:Port=3306:Password=wsp:Url="jdbc:mysql://localhost:3306/\wsp" test_pool

asadmin> create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource
Enter the value for the jdbc_connection_pool_id operand> test_pool
JDBC connection pool test_pool created successfully.

asadmin> create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property Url="jdbc:mysql://localhost:3306/wsp"
Enter the value for the jdbc_connection_pool_id operand> JPAconnPoolMysql
remote failure: Invalid property syntax, missing property value: mysql
Invalid property syntax, missing property value: mysql

asadmin> create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property Url="jdbc\:mysql\://localhost\:3306/wsp"


EXITO

asadmin> create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.ConnectionPoolDataSource --property Url="jdbc\:mysql\://localhost\:3306/wsp" JPAconnectionPool
Command create-jdbc-connection-pool executed successfully.

Despues desde el Glassfish manager se modifica el ConnectionPool Resource se agregan properties User=root y Password=algoalgo

asadmin> create-jdbc-resource --connectionpoolid JPAconnectionPool jdbc/jpa
JDBC resource jdbc/jpa created successfully.
Command create-jdbc-resource executed successfully.
asadmin>

** Creacion para JPA Cases **
asadmin> create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.ConnectionPoolDataSource --property Url="jdbc\:mysql\://localhost\:3306/JPACases" JPAconnPoolCases

asadmin> create-jdbc-resource --connectionpoolid JPAconnPoolCases jdbc/jpaCases

=================================================================Installing Maven for Netbeans build samples

MAVEN_HOME=C:\Program Files\apache-maven-3.5.0
C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Brackets\command;%MAVEN_HOME%\bin;%JAVA_HOME%\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\

No hay comentarios:

Publicar un comentario