Wednesday, March 11, 2015

Oracle updating sequence by a big number

sometimes in DB refresh , the rows are refreshed but corresponding sequences are not refreshed. and the difference may be as huge as 2000-3000. So how can we update the Sequence ?

  1. Can use alter sequence : to modify start value ( not good as different environments will have different definitions)
  2. can write a small java program that selects nextVal from sequence in a for loop 2k-3k
  3. Else can use this
select  level, sequence.NEXTVAL
from  dual 
connect by level <= (select max(pk) from tbl);
 
 

Monday, March 9, 2015

Jasper Report : Working with IN clause in SQL

Today had to work on a jasper report that has a IN clause in SQL.
The issue was , that the parameters were taken from UI in CSV format , so couldnt use the $X approach as described
http://stackoverflow.com/questions/6226447/passing-sql-in-parameter-list-in-jasperreport

The solution was

< parameter name="CNTRY_ID" isForPrompting="true" class="java.lang.String" / >
 < parameter name="CNTRY_ID_PARSED" isForPrompting="true" class="java.lang.String" >
        < defaultValueExpression >< ! [ CDATA [ $P { CNTRY_ID } . replaceAll(",","','") ] ] > < / defaultValueExpression>
 
   
and in the SQL query use it like

 where pt.subacct_id = gs.member_id
   and gs.CNTRY_ID IN ('$P!{CNTRY_ID_PARSED}')
 

Hope that helps

Friday, January 30, 2015

Oracle Reports Unable to Open Reports Builder 11g (Appears Minimized in Taskbar)

This helped me today
http://pitss.com/us/2013/11/25/unable-to-open-reports-builder-11g-appears-minimized-in-taskbar/

And this one
http://stackoverflow.com/questions/18185171/no-pl-sql-translation-for-the-bindtype-given-for-this-bind-variable

Wednesday, January 28, 2015

Handling classpath issues

Came across this issue today
java.lang.NoSuchMethodError    org.apache.commons.codec.binary.Base64.encodebase64

Eventually realized this was because the class Base64 was picked from wrong jar file... the ques was which one , I mean as i got this in web application ... so the hierarchy is not easy to trace.

I tried adding the following line before the exception
logger.debug(Base64.class.getProtectionDomain().getCodeSource().getLocation());

And then eventually modified the classpath settings to modify the issue.

Wednesday, January 21, 2015

Tomcat startup window disappears ?

https://navnith.wordpress.com/2008/12/31/tomcat-startup-window-disappears/

on Command Prompt type: catalina.bat run
this will ensure that the window stays and shows you what the error was which was causing the window to disappear

Wednesday, December 10, 2014

Selenium WebDriver Wait

http://assertselenium.com/2013/01/29/webdriver-wait-commands/

Running Groovy Code From Java


public class CodeExecutor {

    /**
     * @param args
     */
    public static void main(String[] args) {
        runWithGroovyShell();

    }
   
    static void runWithGroovyShell()  {
        new GroovyShell().evaluate("println 'Hello World'");
      }

}

http://stackoverflow.com/questions/3989592/calling-a-groovy-function-from-java