An Interactive Tool for Analyzing Embedded SQL Queries

  • Aivar Annamaa
  • Andrey Breslav
  • Jevgeni Kabanov
  • Varmo Vene
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6461)


It is conventional for Java developers to access database engines through standard JDBC API which requires passing SQL queries in plain Java strings. This is referred to as embedding of SQL queries into Java. The strings are not checked at compile time, and errors in the queries (e.g. syntax errors or misspelled names) are usually detected only by testing. In this paper we describe a tool which statically analyzes SQL queries embedded into Java programs. It combines a sound syntactic analyzer with a testing facility which generates small tests to detect errors in individual queries and runs them on an actual database engine. The tool is implemented as a plug-in for Eclipse IDE and allows for interactive use in real-life projects.


False Alarm Regular Language Java Code Lexical Analysis Database Engine 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    SeamlessSQL (2008),
  2. 2.
  3. 3.
    Bison parser generator (2010),
  4. 4.
    Eclipse IDE (2010),
  5. 5.
    IntelliJ IDEA (2010),
  6. 6.
    Christensen, A.S., Møller, A., Schwartzbach, M.I.: Precise analysis of string expressions. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 1–18. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  7. 7.
    Doh, K.G., Kim, H., Schmidt, D.A.: Abstract parsing: Static analysis of dynamically generated string output using LR-parsing technology. In: Palsberg, J., Su, Z. (eds.) Static Analysis. LNCS, vol. 5673, pp. 256–272. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  8. 8.
    Klein, G.: JFlex Scanner Generator (2009),
  9. 9.
    Kong, S., Choi, W., Yi, K.: Abstract parsing for two-staged languages with concatenation. In: Proceedings of the Eighth International Conference on Generative Programming and Component Engineering, GPCE 2009, pp. 109–116. ACM, New York (2009)CrossRefGoogle Scholar
  10. 10.
    Thiemann, P.: Grammar-based analysis of string expressions. In: Proceedings of the 2005 ACM SIGPLAN International Workshop on Types in languages Design and Implementation, TLDI 2005, pp. 59–70. ACM, New York (2005)CrossRefGoogle Scholar
  11. 11.
    Tomita, M.: Generalized L.R. Parsing. Kluwer Academic Publishers, Norwell (1991)CrossRefGoogle Scholar
  12. 12.
    Wassermann, G., Gould, C., Su, Z., Devanbu, P.: Static checking of dynamically generated queries in database applications. ACM Trans. Softw. Eng. Methodol. 16(4), 14 (2007)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Aivar Annamaa
    • 1
  • Andrey Breslav
    • 2
  • Jevgeni Kabanov
    • 1
  • Varmo Vene
    • 1
  1. 1.University of TartuEstonia
  2. 2.State University ITMOSt. PetersburgRussia

Personalised recommendations