Text Query Via JSP

Question

I have a CSV file and need to import it in JSP page and execute data Base : i have data =

clubId,openDate, beginDate, endDate, extendPro 

1,2013/01/01,2013/01/01,2014/01/01,1 

2,2013/02/01,2013/02/15,2014/02/15,1 

3,2013/03/01,2013/03/15,2014/03/15,1

 

Answer

You can’t access a file with a SQL statement. But it’s complicated to query a text file in JSP or Java, especially when the file is large. Try using SPL (Structured Process Language) to perform the query. To find data where biginDate is later than 2013-01-01 & endDate is earlier than 2014-01-01 from source.csv. Below is the SPL script:

A

1

=file("source.csv").import@t()

2

=A1.select(beginDate>="2013/01/01"   && endDate<="2014/01/01")

The SPL script can be embedded into a Java application and the condition can be passed to it via JSP. That makes a dynamic query. For more information, see How to call an SPL Script in Java