code: public static DatabaseEngine getConnection(Properties p) throws DatabaseFactoryException {
          PdbProperties pdbProperties = new PdbProperties(p, true);
          final String engine = pdbProperties.getEngine();
  
          if (StringUtils.isBlank(engine)) {
              throw new DatabaseFactoryException("pdb.engine property is mandatory");
          }
  
          try {
              Class<?> c = Class.forName(engine);
  
              Constructor cons = c.getConstructor(PdbProperties.class);
              final AbstractDatabaseEngine de = (AbstractDatabaseEngine) cons.newInstance(pdbProperties);
  
              Class<? extends AbstractTranslator> tc = de.getTranslatorClass();
  
              if (pdbProperties.isTranslatorSet()) {
                  final Class<?> propertiesTranslator = Class.forName(pdbProperties.getTranslator());
                  if (!AbstractTranslator.class.isAssignableFrom(propertiesTranslator)) {
                      throw new DatabaseFactoryException("Provided translator does extend from AbstractTranslator.");
                  }
  
                  tc = (Class<? extends AbstractTranslator>) propertiesTranslator;
              }
  
  
              final Injector injector = Guice.createInjector(
                      new PdbModule.Builder()
                              .withTranslator(tc)
                              .withPdbProperties(pdbProperties)
                              .build());
              injector.injectMembers(de);
  
              return de;
          } catch (final DatabaseFactoryException e) {
              throw e;
          } catch (final Exception e) {
              throw new DatabaseFactoryException(e);
          }
      }
docs: Gets a database connection from the specified properties.
  
  @param p The database properties.
  @return A reference of the specified database engine.
  @throws DatabaseFactoryException If the class specified does not exist or its not well implemented.