Difference between revisions of "NexJ Express Connecting to PostgreSQL"

From CDOT Wiki
Jump to: navigation, search
Line 9: Line 9:
 
::
 
::
 
<source lang=java>
 
<source lang=java>
   /* MySQLAdapterTest.java */
+
   /* SysUtil.java */
      try
+
  public static Properties getConfigProperties()
      {
+
  {
        s_metadata = loadMetadata(ADAPTER_NAME);
+
      return s_configProperties;
      }
+
  }  
 
 
  
 
   /* SQLDataTest.java */
 
   /* SQLDataTest.java */

Revision as of 11:12, 22 November 2010

PostgreSQL Adapter for NexJ - Create Test Environment

  • 1- Setup the postgresql-connection
Configure the work/ws/core/bin/nexj/default.config
Configure the work/ws/core/test/nexj/default.config
Configure the work/ws/core/bin/nexj/postgresql.connection
Configure the work/ws/core/test/nexj/postgresql.connection
   /* SysUtil.java */
   public static Properties getConfigProperties()
   {
      return s_configProperties;
   } 

   /* SQLDataTest.java */
   protected static Metadata loadMetadata(String sAdapter)
   {
      Properties props = SysUtil.getConfigProperties();
      props = new Properties(props);
      props.setProperty(XMLMetadataLoader.CONNECTIONS_URL_PROPERTY, "/nexj/" + sAdapter.toLowerCase(Locale.ENGLISH) + ".connections");  // the postgresql.connection is hardcoded
  • 2- Add PostgreSQL database to related java files
SQLSchemaMangerFactory.java
RelationalDatabaseFragment.java
  • 3- Create the extended PostgreSQL source files
PostgreSQLAdapter.java
PostgreSQLSchemaManger.java
  • 4- Create the extended PostgreSQL test files
PostgreSQLAdapterTest.java
PostgreSQLSchemaMangerTest.java