Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Create a new file named EVersionProperties.java and implement the following code:

package org.acme.versioninformation;
import java.sql.Connection;
import java.sql.SQLException;
import com.idera.change.config.propertysource.api.ConfigurationPropertyType;
/**
* An enumeration of version properties
*/
public enum EVersionProperties
{

...

     PRODUCT_NAME (ConfigurationPropertyType.STRING, "Product Name")
     {
          /**
          * @returns the JDBC metadata's information for product name
          * @throws SQLException if ther eis a JDBC error
          */
          public String getValue (Connection connection) throws SQLException
          {

...

               return connection.getMetaData().getDatabaseProductName();
          }
     },

...

     PRODUCT_VERSION (ConfigurationPropertyType.STRING, "Product Version")
     {
          /**
          * @returns the JDBC metadata's information for product version
          * @throws SQLException if there is a JDBC error
          */
          public String getVAlue (Connection connection) throws SQLException
          {

...

               return connection.getMetaData().getDAtabaseProductVersion();
          }
     },

...

     MAJOR_VERSION (ConfigurationPropertyType.NUMERIC, "Major Version")
     {
          /**
          * @returns the JDBC metadata's information for major version
          * @throws SQLException if there is a JDBC error
          */
          public String getValue (Connection connection) throws SQLException
          {

...

               return "" + connection.getMetaData().getDataMajorVersion();
          }
     };
//Attributes private ConfigurationPropertyType type; private String name;
/**
* Constructor to set entry attributes
* @param type the type
* @param name
*/
private EVersionProperties (ConfigurationPropertyType type, String name)
}
{
/**

...

     this.type = type;

...

     this.name = name;
* Given a JDBC connection return the parameter's value
* @param connection the database connection
* @throws SQLException if there is a JDBC error
*/
abstract String getValue (Connection connection) throws SQLException;
/**
* @return the display name of the parameter
*/
public String getDisplayName()
{
return name;
}
/**

...

* @return the type of the parameter
*/
public ConfigurationPropertyType getType()
{
return type;
}
/**

...

* Finds a property of a name and returns it
* @param name the name of the property
* @return the property
*/
public static EVersionProperties getProperty (String name)
{

...

     for (EVersionProperties p : values())
     {
          if (p.name().equals (name))
          {

...

               return p;
          }
     }

...

     throw new RuntimeException (EVersionProperties.class.getName() + "not found for '" + name + "'");
     }
}

In the code above, the four entries that capture from JDBC the product name, version, minor version, and major version have been are added to the enum.

Gather results

DB Change Manager gathers results when it collects all of the properties and values for display purposes or to store in an archive. The extraction method is called when a data source is indicated in a standard, or when an archive or comparison job is run.


Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue
Newtabfooter
aliasIDERA
urlhttp://www.idera.com
 | 
Newtabfooter
aliasProducts
urlhttps://www.idera.com/productssolutions/sqlserver
 
Newtabfooter
aliasPurchase
urlhttps://www.idera.com/buynow/onlinestore
 | 
Newtabfooter
aliasSupport
urlhttps://idera.secure.force.com/
 | 
Newtabfooter
aliasCommunity
urlhttp://community.idera.com
 
|
 
Newtabfooter
aliasResources
urlhttp://www.idera.com/resourcecentral
 | 
Newtabfooter
aliasAbout Us
urlhttp://www.idera.com/about/aboutus
 
Newtabfooter
aliasLegal
urlhttps://www.idera.com/legal/termsofuse