Examples of Jdbc


Examples of org.jooq.util.jaxb.Jdbc

            }
        }
  }

  public static void main(Properties properties, String... args) throws Exception {
      Jdbc jdbc = new Jdbc();
      jdbc.setDriver(properties.getProperty("jdbc.Driver"));
      jdbc.setUrl(properties.getProperty("jdbc.URL"));
      jdbc.setUser(properties.getProperty("jdbc.User"));
      jdbc.setPassword(properties.getProperty("jdbc.Password"));
      jdbc.setSchema(properties.getProperty("jdbc.Schema"));

      Strategy strategy = new Strategy();
      strategy.setName(properties.containsKey("generator.strategy") ? properties.getProperty("generator.strategy") : null);

      List<MasterDataTable> masterDataTables = new ArrayList<MasterDataTable>();
View Full Code Here

Examples of org.jooq.util.jaxb.Jdbc

        }
  }

  @SuppressWarnings("unchecked")
    public static void main(Configuration configuration) throws Exception {
      Jdbc j = configuration.getJdbc();
      org.jooq.util.jaxb.Generator g = configuration.getGenerator();

      // Some default values for optional elements to avoid NPE's
      if (g.getStrategy() == null)
          g.setStrategy(new Strategy());
      if (g.getTarget() == null)
          g.setTarget(new Target());

        Class.forName(j.getDriver());
        Connection connection = null;

        try {

            // Initialise connection
            // ---------------------
            Properties properties = new Properties();
            for (Property p : j.getProperties()) {
                properties.put(p.getKey(), p.getValue());
            }

            if (!properties.containsKey("user"))
                properties.put("user", defaultString(j.getUser()));
            if (!properties.containsKey("password"))
                properties.put("password", defaultString(j.getPassword()));

            connection = DriverManager.getConnection(defaultString(j.getUrl()), properties);

            // Initialise generator
            // --------------------
            Class<Generator> generatorClass = (Class<Generator>) (!isBlank(g.getName())
                ? Class.forName(trim(g.getName()))
                : DefaultGenerator.class);
            Generator generator = generatorClass.newInstance();

            Class<GeneratorStrategy> strategyClass = (Class<GeneratorStrategy>) (!isBlank(g.getStrategy().getName())
                ? Class.forName(trim(g.getStrategy().getName()))
                : DefaultGeneratorStrategy.class);
            GeneratorStrategy strategy = strategyClass.newInstance();

            generator.setStrategy(strategy);

            Class<Database> databaseClass = (Class<Database>) Class.forName(trim(g.getDatabase().getName()));
            Database database = databaseClass.newInstance();

            List<Schema> schemata = g.getDatabase().getSchemata();
            if (schemata.isEmpty()) {
                Schema schema = new Schema();
                schema.setInputSchema(trim(g.getDatabase().getInputSchema()));
                schema.setOutputSchema(trim(g.getDatabase().getOutputSchema()));
                schemata.add(schema);
            }
            else {
                if (!StringUtils.isBlank(g.getDatabase().getInputSchema())) {
                    log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/inputSchema and /configuration/generator/database/schemata");
                }
                if (!StringUtils.isBlank(g.getDatabase().getOutputSchema())) {
                    log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/outputSchema and /configuration/generator/database/schemata");
                }
            }

            for (Schema schema : schemata) {
                if (StringUtils.isBlank(schema.getInputSchema())) {
                    if (!StringUtils.isBlank(j.getSchema())) {
                        log.warn("WARNING: The configuration property jdbc.Schema is deprecated and will be removed in the future. Use /configuration/generator/database/inputSchema instead");
                    }

                    schema.setInputSchema(trim(j.getSchema()));
                }

                if (StringUtils.isBlank(schema.getOutputSchema())) {
                    schema.setOutputSchema(trim(schema.getInputSchema()));
                }
View Full Code Here

Examples of org.latte.scripting.hostobjects.JDBC

    register("sleep", new Sleep());
    register("shell", new Shell());
    register("open", new Open());
    register("hget", new HGet());
    register("hpost", new HPost());
    register("jdbc", new JDBC());
    register("gethostbyaddr", new GetHostByAddr());
 
    ScriptableObject.defineClass(this.parent, RWLock.class);
   
    Context.exit();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.