Difference between revisions of "NexJ Express Connecting to PostgreSQL"

From CDOT Wiki
Jump to: navigation, search
Line 2: Line 2:
 
{{NexJ_Express Index}}
 
{{NexJ_Express Index}}
  
== 1- Setup the postgresql-connection ==
+
=== 1- Setup the postgresql-connection ===
 
: Configure the work/ws/core/test/nexj/postgresql.config
 
: Configure the work/ws/core/test/nexj/postgresql.config
 
: Configure the work/ws/core/test/nexj/postgresql.connection
 
: Configure the work/ws/core/test/nexj/postgresql.connection
Line 21: Line 21:
 
</source>
 
</source>
  
== 2- Add PostgreSQL adapter type to related java files==
+
=== 2- Add PostgreSQL adapter type to related java files===
 
: SQLSchemaMangerFactory.java
 
: SQLSchemaMangerFactory.java
 
: RelationalDatabaseFragment.java
 
: RelationalDatabaseFragment.java
 
:: The package that is being imported: <code> org.postgresql.jdbc3.Jdbc3.SimpleDataSource </code>
 
:: The package that is being imported: <code> org.postgresql.jdbc3.Jdbc3.SimpleDataSource </code>
  
== 3- Create a PostgreSQL database through some scripts==
+
=== 3- Create a PostgreSQL database through some scripts===
 
: postgresql_setup.sql
 
: postgresql_setup.sql
  
* 4- Create the extended PostgreSQL source files  
+
=== 4- Create the extended PostgreSQL source files ===
 
: PostgreSQLAdapter.java
 
: PostgreSQLAdapter.java
 
: PostgreSQLSchemaManger.java
 
: PostgreSQLSchemaManger.java
  
* 5- Create the extended PostgreSQL test files  
+
=== 5- Create the extended PostgreSQL test files ===
 
: PostgreSQLAdapterTest.java
 
: PostgreSQLAdapterTest.java
 
: PostgreSQLSchemaMangerTest.java
 
: PostgreSQLSchemaMangerTest.java

Revision as of 14:37, 22 November 2010

PostgreSQL Adapter for NexJ - Create Test Environment

1- Setup the postgresql-connection

Configure the work/ws/core/test/nexj/postgresql.config
Configure the work/ws/core/test/nexj/postgresql.connection
   /* 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

2- Add PostgreSQL adapter type to related java files

SQLSchemaMangerFactory.java
RelationalDatabaseFragment.java
The package that is being imported: org.postgresql.jdbc3.Jdbc3.SimpleDataSource

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