Difference between revisions of "NexJ Express Connecting to PostgreSQL"
(→1- Setup the postgresql-connection) |
(→1- Setup the postgresql-connection) |
||
Line 3: | Line 3: | ||
=== 1- Setup the postgresql-connection === | === 1- Setup the postgresql-connection === | ||
− | + | * TODOs | |
+ | : Create and Configure the work/ws/core/test/nexj/postgresql.config | ||
:: for now, the contents of default.config is changed to postgresql specifications instead of mysql | :: for now, the contents of default.config is changed to postgresql specifications instead of mysql | ||
+ | : walk-through lines from 214-218 in SQLManagementConnectionFactory.java | ||
+ | : Walk-through properties and see what exactly is needed to be authorized to connect to 'test' database | ||
+ | : Make sure the model connects to the PostgreSQL using user 'test' | ||
+ | * Done | ||
: Configure the work/ws/core/test/nexj/postgresql.connection | : Configure the work/ws/core/test/nexj/postgresql.connection | ||
+ | : Load the driver from RelationalDatabaseFragment.java | ||
+ | :: The package that is being imported: <code> org.postgresql.xa.PGXADataSource </code> | ||
+ | : Load metadata from the particular driver | ||
:: | :: | ||
<source lang=java> | <source lang=java> | ||
Line 21: | Line 29: | ||
props.setProperty(XMLMetadataLoader.CONNECTIONS_URL_PROPERTY, "/nexj/" + sAdapter.toLowerCase(Locale.ENGLISH) + ".connections"); // sets the properties to postgresql.connection | props.setProperty(XMLMetadataLoader.CONNECTIONS_URL_PROPERTY, "/nexj/" + sAdapter.toLowerCase(Locale.ENGLISH) + ".connections"); // sets the properties to postgresql.connection | ||
</source> | </source> | ||
− | + | : Configure system.dstype | |
− | : | + | : Configure DatabaseTools.java // This file calles SQLSchemaMangerFactory.java and creates the connection |
− | : | + | : Configure RelationalDatabase.java SQLRAConnectionFactory.java |
+ | : Configure Driver type and some other properties in JDBCInfo.java | ||
=== 2- Add PostgreSQL adapter type to related java files=== | === 2- Add PostgreSQL adapter type to related java files=== |
Revision as of 23:28, 29 November 2010
PostgreSQL Adapter for NexJ - Create Test Environment
Contents
1- Setup the postgresql-connection
- TODOs
- Create and Configure the work/ws/core/test/nexj/postgresql.config
- for now, the contents of default.config is changed to postgresql specifications instead of mysql
- walk-through lines from 214-218 in SQLManagementConnectionFactory.java
- Walk-through properties and see what exactly is needed to be authorized to connect to 'test' database
- Make sure the model connects to the PostgreSQL using user 'test'
- Done
- Configure the work/ws/core/test/nexj/postgresql.connection
- Load the driver from RelationalDatabaseFragment.java
- The package that is being imported:
org.postgresql.xa.PGXADataSource
- The package that is being imported:
- Load metadata from the particular driver
/* MySQLAdapterTest.java */
try
{
s_metadata = loadMetadata(ADAPTER_NAME);
}
/* SQLDataTest.java */
protected static Metadata loadMetadata(String sAdapter)
{
Properties props = SysUtil.getConfigProperties(); // sets DEFAULT_CONFIG_URL = '/' + NAMESPACE + "/default.config"
props = new Properties(props);
props.setProperty(XMLMetadataLoader.CONNECTIONS_URL_PROPERTY, "/nexj/" + sAdapter.toLowerCase(Locale.ENGLISH) + ".connections"); // sets the properties to postgresql.connection
- Configure system.dstype
- Configure DatabaseTools.java // This file calles SQLSchemaMangerFactory.java and creates the connection
- Configure RelationalDatabase.java SQLRAConnectionFactory.java
- Configure Driver type and some other properties in JDBCInfo.java
- SQLSchemaMangerFactory.java
3- Create a PostgreSQL database through some scripts
- postgresql_setup.sql
4- Create the extended PostgreSQL source files
- PostgreSQLAdapter.java
- PostgreSQLSchemaManger.java
5- Create the extended PostgreSQL test files
- PostgreSQLAdapterTest.java
- PostgreSQLSchemaMangerTest.java