Skip to Content

 I am new to the MDM Java API. For one of the existing project I was asked to explore the new MDM Java API. I do not have any experience with the earlier MDM4J but still I was able to understand and explore the new MDM Java API. I think this API is excellent and I am almost fallen in love with it. The best part I like about this API is the Commands. Initially it took me time to understand the concept but very soon it was all clear. With this blog I would like to share my knowledge about how to work with Commands.  Also in this blog you will see an example of Validation Command.



Why you need a Command? What is a Command?


I command the MDM Java API to get me the list of Validations …..  /<br />package demo.validation;</p><p style=”margin: 0cm 0cm 0pt” class=”MsoNormal”>import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;<br />import;</p><p style=”margin: 0cm 0cm 0pt” class=”MsoNormal”>/*
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
public class GetListOfValidations {

 public static void main(String[] args) {
  // create connection pool to a MDM server
  String serverName = “LOCALHOST”;
  ConnectionPool connections = null;
  try {
   connections = ConnectionPoolFactory.getInstance(serverName);
  } catch (ConnectionException e) {

  // specify the repository to use
  // alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand
  String repositoryName = “INQDemo”;
  String dbmsName = “localhost”;
  RepositoryIdentifier reposId =
   new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.ORACLE);

  // get list of available regions for the repository
  GetRepositoryRegionListCommand regionListCommand =
   new GetRepositoryRegionListCommand(connections);
  try {
  } catch (CommandException e) {
  RegionProperties[] regions = regionListCommand.getRegions();

  // create a user session
  CreateUserSessionCommand sessionCommand =
   new CreateUserSessionCommand(connections);
  sessionCommand.setDataRegion(regions[0]); // use the first region
  try {
  } catch (CommandException e) {
  String sessionId = sessionCommand.getUserSession();

  // authenticate the user session
  String userName = “admin”;
  String userPassword = “admin”;
  AuthenticateUserSessionCommand authCommand =
   new AuthenticateUserSessionCommand(connections);
  try {
  } catch (CommandException e) {

  // the main table, hard-coded
  TableId mainTableId = new TableId(1);

  // Get the list of validations

  RetrieveValidationsCommand objRtvVldCmd =
   new RetrieveValidationsCommand(connections);
  // set the user session
  // get validation for the following tables.

  try {

  } catch (CommandException e) {

  ValidationPropertiesResult objVldPropRslt =

  ValidationProperties[] validations = objVldPropRslt.getValidations();

  //disply –> Validation ID | error/warning message | Validation Name
  for (int i = 0; i < validations.length; i++) {
     + ” | “
     + validations[i].getMessage()
     + ” | “
     + validations[i].getName());


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member
    Hi Vijendra,
    Thanks a lot for such a nice blog.

    But I am having a problem in finding this “RetrieveValidationsCommand” class. I am not able to find this package “ ” which contains this class.

    I am using MDM 5.5 SP04 version.
    I have added following Jars in my project MDM4J.jar

    Can u just tell me in which jar i will be able to find out the these packages?

    Thanks in Advance.

    1. Former Member Post author
      Hi Shruti

      The Jar’s that you have included in your project is right. Only thing is that I have worked on MDM 5.5 SP6 Patch 0.

      This class is present in mdm-data.jar

      Good Luck
      Vijendra S Bhanot

  2. Former Member

    I am getting the following exception while establing the connection ti the server . Could not open minimum connections.

    What could be the reason.

    As my server is not LocalHost ,I am giving the server name as ….serverName = “Host:Port”;

    Am I missing something here ?



Leave a Reply