Oracle WebCenter Content (MOSC)

MOSC Banner

Capture DB connection using client level script

edited Jul 31, 2020 3:55AM in Oracle WebCenter Content (MOSC) 4 commentsAnswered ✓

Hi All,

How we can connect Capture DB using some client level script? The below method is working fine in recognition level and import level but failing at client level with the error- ""javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial", Basically how to initialize/import this CTX object/class at client level?

load('nashorn:mozilla_compat.js');importClass(Packages.oracle.odc.data.IndexValue);importClass(javax.swing.JOptionPane);function validateUserdetails(ctx,aID){//java.lang.System.out.println("validateUserdetails starts executing!");var initCtx = null;var ds = null;var con = null;var stmt = null;var rs = null;var query = "select emp_name from per_all_people_f where emp_name = '" + aID + "'" ;print("validateUserdetails SelectQueryIs : " + query + "\n");var returnVAlue = false;try{initCtx = new javax.naming.InitialContext();ds = initCtx.lookup("jdbc/capture-ds");if(ds != null){con = ds.getConnection();stmt = con.createStatement();print("validateUserdetails : Connected and Statement created with  DB\n");rs = stmt.executeQuery(query);print("validateUserdetails : rs details " +rs);if(rs!= null){while(rs.next()){print("validateUserdetails : just after rs");var userId = rs.getString("emp_name");print("UserId from EBS Table is: " +userId);if (userId.trim() == aID.trim()){print("validateUserdetails : User exists in  DB and validated");

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center