skip to main content
10.1145/1062455.1062487acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
Article

SQL DOM: compile time checking of dynamic SQL statements

Published:15 May 2005Publication History

ABSTRACT

Most object oriented applications that involve persistent data interact with a relational database. The most common interaction mechanism is a call level interface (CLI) such as ODBC or JDBC. While there are many advantages to using a CLI -- expressive power and performance being two of the most key -- there are also drawbacks. Applications communicate through a CLI by constructing strings that contain SQL statements. These SQL statements are only checked for correctness at runtime, tend to be fragile and are vulnerable to SQL injection attacks. To solve these and other problems, we present the SQL DOM: a set of classes that are strongly-typed to a database schema. Instead of string manipulation, these classes are used to generate SQL statements. We show how to extract the SQL DOM automatically from an existing database schema, demonstrate its applicability to solve the mentioned problems, and evaluate its performance.

References

  1. .NET Framework. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/netfxanchor.asp, 2004.Google ScholarGoogle Scholar
  2. ADO.NET. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaccessingdatawithadonet.asp, 2004.Google ScholarGoogle Scholar
  3. Atkinson, M. P., and Morrison, R. Orthogonally persistent object systems. VLDB Journal, 4(3):319--401, 1995. Google ScholarGoogle ScholarCross RefCross Ref
  4. American National Standard for Information Technology. Database languages -- SQLJ -- Part 1: SQL routines using the Java programming language. Technical Report ANSI/INCITS 331.1-1999, InterNational Committee for Information Technology Standards (formerly NCITS), 1999.Google ScholarGoogle Scholar
  5. Brant, J., and Yoder, J. W. Creating reports with query objects. In Harrison, N., Foote, B., and Rohnert, H., editors, Pattern Languages of Program Design 4. Addison Wesley, 2000.Google ScholarGoogle Scholar
  6. C#. http://msdn.microsoft.com/vcsharp/, 2004.Google ScholarGoogle Scholar
  7. Cengija, D. Hibernate your data. onJava.com, 2004.Google ScholarGoogle Scholar
  8. Clark, J., and DeRose, S. XML Path Language (XPath) Version 1.0. Technical report, W3C, 1999.Google ScholarGoogle Scholar
  9. Cook, W., and Rai, S. Safe Query Objects: Statically-typed objects as remotely-executable queries. http://www.cs.utexas.edu/users/wcook/Drafts/SafeQuery_CookRai.pdf, 2004.Google ScholarGoogle Scholar
  10. Dub, J. A., Sapir, R., and Purich, P. Oracle Application Server TopLink application developers guide, 10g (9.0.4). Oracle Corporation, 2003.Google ScholarGoogle Scholar
  11. Embedded SQL for C. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/esqlforc/ec_6_epr_01_3m03.asp, 2004.Google ScholarGoogle Scholar
  12. Gould, C., Su, Z., and Devanbu, P. Static checking of dynamically generated queries in database applications. In Proceedings, 26 th International Conference on Software Engineering (ICSE). IEEE Press, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Hamilton, G., and Cattell, R. JDBC patterns. Sun Microsystems, 2003.Google ScholarGoogle Scholar
  14. Howard, M., and LeBlanc, D. Writing Secure Code, Second Edition, Microsoft Press, ch. 12, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Keller, W. Mapping objects to tables - a pattern language. In Proceedings of the 1997 European Pattern Languages of Programming Conference, number 120/SW1/FB in Siemens Technical Report, Irsee, Germany, X. EA Generali, Vienna, Austria.Google ScholarGoogle Scholar
  16. Leijen, D., and Meijer, E., Domain specific embedded compilers. In Proceedings of the 2 nd conference on Domain-specific languages, pages 109--122. ACM Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Maier, D. Representing database programs as objects. In Bancilhon, F., and Buneman, P., editors, Advances in Database Programming Languages, Papers from DBPL-1, September 1987, Roscoff, France, pages 377--386. ACM Press / Addison Wesley, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Matena, V., and Hapner, M. Enterprise Java Beans Specification 1.0. Sun Microsystems, 1998.Google ScholarGoogle Scholar
  19. Oracle SQLJ Roadmap, http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/oracle_sqlj_roadmap.pdf, 2004.Google ScholarGoogle Scholar
  20. Russell, C. Java Data Objects (JDO) Specification JSR-12. Sun Microsystems, 1998.Google ScholarGoogle Scholar
  21. Sanders, R. E. ODBC 3.5 Developer's Guide. M&T Books, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Smith, E. J. CodeSmith. http://www.ericjsmith.net/codesmith/, 2004.Google ScholarGoogle Scholar

Index Terms

  1. SQL DOM: compile time checking of dynamic SQL statements

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ICSE '05: Proceedings of the 27th international conference on Software engineering
        May 2005
        754 pages
        ISBN:1581139632
        DOI:10.1145/1062455

        Copyright © 2005 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 15 May 2005

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • Article

        Acceptance Rates

        Overall Acceptance Rate276of1,856submissions,15%

        Upcoming Conference

        ICSE 2025

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader