6.8.2.6 Dropping A Property Graph View

You can use PGQL to drop property graph views. When a DROP PROPERTY GRAPH statement is called, all the metadata tables for the property graph view are dropped.

Drop a Property Graph View Using JShell

  1. Launch the JShell to work with the database as shown:
    ./bin/opg4j --no_connect
  2. Execute the following commands to drop a property graph view:

    opg4j> var jdbcUrl="jdbc:oracle:thin:@<host_name>:<port>/<db_service>"
    opg4j> var conn = DriverManager.getConnection(jdbcUrl,"<username>","<password>")
    opg4j> var pgqlConn = PgqlConnection.getConnection(conn)
    opg4j> var pgqlStmt = pgqlConn.createStatement() //create a PGQL Statement
    opg4j> pgqlStmt.execute("DROP PROPERTY GRAPH <pgview>")
    $9 ==> false

Drop a Property Graph View Using Java

The following example shows how to drop a property graph view.

import java.sql.Connection;
import java.sql.Statement;
import oracle.pg.rdbms.pgql.PgqlConnection;
import oracle.pg.rdbms.pgql.PgqlStatement;
import oracle.ucp.jdbc.PoolDataSourceFactory;
import oracle.ucp.jdbc.PoolDataSource;
/**
 * This example shows how to drop a property graph view.
 */
public class DropPgView
{

  public static void main(String[] args) throws Exception
  {
    int idx=0;
    String host               = args[idx++]; 
    String port               = args[idx++]; 
    String sid                = args[idx++]; 
    String user               = args[idx++]; 
    String password           = args[idx++];
    String pgview             = args[idx++];
  
    
    Connection conn = null;
    PgqlStatement pgqlStmt = null;
    
    try {
      //Get a jdbc connection
      PoolDataSource  pds = PoolDataSourceFactory.getPoolDataSource();
      pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
      pds.setURL("jdbc:oracle:thin:@"+host+":"+port +"/"+sid);
      pds.setUser(user);
      pds.setPassword(password);     
      conn = pds.getConnection();
      conn.setAutoCommit(false);
          
      // Get a PGQL connection
      PgqlConnection pgqlConn = PgqlConnection.getConnection(conn);
	  
	  // Create PGQL Statement
      pgqlStmt = pgqlConn.createStatement();

      String query = "DROP PROPERTY GRAPH " +pgview;
      pgqlStmt.execute(query);
      
    }
    finally {
      // close the statement
      if (pgqlStmt != null) {
         pgqlStmt.close();
         }
      // close the connection
      if (conn != null) {
         conn.close();
         }
      }
  }
}