Glassfish JDBC Connection Pool
Go to: asadmin
create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --property portNumber=1527:password=user1:user=user1:serverName=localhost:databaseName=Derby-DB:connectionAttributes=\;create\\=true Derby-DB_pool
- Apache Derby IJ:
Necessary setup of Apache Derby from CMD (to test with IJ):
- Indicate where your Derby folder is:
(in this case
C:\dev\glassfish\glassfish4\javadb
- Set
DERBY_INSTALL
:
set DERBY_INSTALL=C:\dev\glassfish\glassfish4\javadb\
set DERBY_HOME=C:\dev\glassfish\glassfish4\javadb
set CLASSPATH=C:\dev\glassfish\glassfish4\javadb\lib\derby.jar;C:\dev\glassfish\glassfish4\javadb\lib\derbytools.jar;
- Do tests:
java org.apache.derby.tools.sysinfo
- Use IJ
*
java org.apache.derby.tools.ij
*
connect 'jdbc:derby:Derby-DB;create=true';
- Install Database and Database Driver:
- Fill in DATABASE with basic information:
CREATE SCHEMA USER1; CREATE TABLE "USER1".ADMINISTRATORS ( EMAIL VARCHAR(50) not null primary key, PASSWORD VARCHAR(50) not null ); CREATE TABLE "USER1".EXISTING_SERVER ( IP_ADDRESS VARCHAR(20) not null primary key ); CREATE TABLE USER1.HISTORY_RECORD ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), method_used VARCHAR(50) NOT NULL, result_from_method VARCHAR(20000) NOT NULL, server_address VARCHAR(20) NOT NULL, CONSTRAINT pk_history PRIMARY KEY (id) ); ALTER TABLE user1.history_record ADD FOREIGN KEY (server_address) REFERENCES user1.existing_server (ip_address); INSERT INTO user1.administrators VALUES ('admin@admin', 'admin'); INSERT INTO user1.existing_server (ip_address) VALUES ('127.0.0.1'); INSERT INTO user1.history_record (method_used, result_from_method, server_address) VALUES ('cpu', '20%', '127.0.0.1'); SELECT * FROM user1.administrators; SELECT * FROM user1.history_record; SELECT * FROM user1.existing_server; DROP TABLE user1.administrators; DROP TABLE user1.history_record; DROP TABLE user1.existing_server;