Package org.apache.metamodel.jdbc

Examples of org.apache.metamodel.jdbc.JdbcDataContext


     * @param ds
     *            a JDBC datasource
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(DataSource ds) {
        return new JdbcDataContext(ds);
    }
View Full Code Here


     * @param catalogName
     *            a catalog name to use
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(Connection connection, String catalogName) {
        return new JdbcDataContext(connection, TableType.DEFAULT_TABLE_TYPES, catalogName);
    }
View Full Code Here

     * @param tableTypes
     *            the types of tables to include in the generated schemas
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(Connection connection, TableType... tableTypes) {
        return new JdbcDataContext(connection, tableTypes, null);
    }
View Full Code Here

     *            the types of tables to include in the generated schemas
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(Connection connection, String catalogName,
            TableType[] tableTypes) {
        return new JdbcDataContext(connection, tableTypes, catalogName);
    }
View Full Code Here

     * @param tableTypes
     *            the types of tables to include in the generated schemas
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(DataSource ds, TableType... tableTypes) {
        return new JdbcDataContext(ds, tableTypes, null);
    }
View Full Code Here

     * @param tableTypes
     *            the types of tables to include in the generated schemas
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(DataSource ds, String catalogName, TableType[] tableTypes) {
        return new JdbcDataContext(ds, tableTypes, catalogName);
    }
View Full Code Here

     * @param catalogName
     *            a catalog name to use
     * @return a DataContext object that matches the request
     */
    public static UpdateableDataContext createJdbcDataContext(DataSource ds, String catalogName) {
        return new JdbcDataContext(ds, TableType.DEFAULT_TABLE_TYPES, catalogName);
    }
View Full Code Here

    super.setUp();
    Class.forName("oracle.jdbc.OracleDriver");
    _connection = DriverManager.getConnection(CONNECTION_STRING, USERNAME,
        PASSWORD);
    _connection.setReadOnly(true);
    _dataContext = new JdbcDataContext(_connection);
  }
View Full Code Here

  /**
   * Ticket #170: getIndexInfo causes SQLException. We test that resultsets
   * are closed properly.
   */
  public void testIndexInfo() throws Exception {
    Schema schema = new JdbcDataContext(_connection,
        new TableType[] { TableType.TABLE }, null)
        .getSchemaByName("SYS");
    assertEquals(12, schema.getTableCount());
  }
View Full Code Here

        .getSchemaByName("SYS");
    assertEquals(12, schema.getTableCount());
  }

  public void testGetSchemaNames() throws Exception {
    DataContext dc = new JdbcDataContext(_connection);
    String[] schemaNames = dc.getSchemaNames();

    String concatSchemas = Arrays.toString(schemaNames);

    // In order to allow the database to be used for other purposes than
    // this integration test, we will not make an exact assertion as to
    // which schema names exist, but just assert that HR and the default
    // oracle schemas exist.
    assertTrue(concatSchemas.indexOf("foobar_schema_that_does_not_exist") == -1);
    assertTrue(concatSchemas.indexOf("HR") != -1);
    assertTrue(concatSchemas.indexOf("SYSTEM") != -1);
    assertTrue(concatSchemas.indexOf("XDB") != -1);
    assertTrue(schemaNames.length > 8);

    Schema schema = dc.getDefaultSchema();
    assertEquals("HR", schema.getName());
  }
View Full Code Here

TOP

Related Classes of org.apache.metamodel.jdbc.JdbcDataContext

Copyright © 2018 www.massapicom. 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.