Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BeanShell script error: Parse error

VivekkumarManiraoNov 12 2013 — edited Nov 13 2013

Hi All,

I am trying to drop objects from database by using ODI procedure and keeping the tech as JAVA Shellbean

Please find below code that i use:

<@

import java.io.*;

import java.sql.*;

import java.lang.*;

String url="jdbc:oracle:thin:@dummy:1521:Test";

String id="Test1";

String pass ="Test2";

Connection myCon1 = java.sql.DriverManager.getConnection(url,id,pass);

Connection myCon2 = java.sql.DriverManager.getConnection(url,id,pass);

Statement myStmt1 = myCon1.createStatement();

Statement myStmt2 = myCon2.createStatement();

String sql1="SELECT OBJECT_NAME,OBJECT_TYPE  FROM USER_OBJECTS_T";

ResultSet  rs = myStmt1.executeQuery(sql1);

String  type = null;

String  name = null;

String sql2 = null;

String joins = null;

try {


while(rs.next())

{

type = rs.getString(1);

name = rs.getString(2);

sql2 = "DROP  " + type + "  " + name) ;

myStmt2.executeUpdate( sql2 );

}

rs.close();

myStmt2.close();

myStmt1.close();

myCon1.close();

myCon2.close();

}

catch (SQLException e)

{

out.println(e.getMessage());

}

@>

When i execute above code it throws below error:

org.apache.bsf.BSFException: BeanShell script error: Parse error at line 1, column 36.  Encountered: 950 BSF info: Clean database at line: 0 column: columnNo

  at bsh.util.BeanShellBSFEngine.eval(Unknown Source)

  at bsh.util.BeanShellBSFEngine.exec(Unknown Source)

  at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.execInBSFEngine(SnpScriptingInterpretor.java:322)

  at com.sunopsis.dwg.codeinterpretor.SnpScriptingInterpretor.exec(SnpScriptingInterpretor.java:170)

  at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java:2473)

  at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:48)

  at oracle.odi.runtime.agent.execution.cmd.ScriptingExecutor.execute(ScriptingExecutor.java:1)

  at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)

  at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)

  at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)

  at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:580)

  at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)

  at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)

  at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)

  at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)

  at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)

  at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)

  at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)

  at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)

  at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)

  at java.lang.Thread.run(Thread.java:662)

But when analysing the root cause on this ,i found that the problem on below code

sql2 = "DROP  " + type + "  " + name) ;

myStmt2.executeUpdate( sql2 ); //getting error at this step

Please let me know ,if any one aware or how clear this error.

Thanks in advance !

By Vivekkumar

This post has been answered by Tom Underhill on Nov 12 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2013
Added on Nov 12 2013
5 comments
4,461 views