{"id":3709,"date":"2012-11-27T22:00:10","date_gmt":"2012-11-27T20:00:10","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=3709"},"modified":"2012-11-27T23:18:55","modified_gmt":"2012-11-27T21:18:55","slug":"sql-injection-in-java-application","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html","title":{"rendered":"SQL Injection in Java Application"},"content":{"rendered":"<p>In this post we will discuss what is an <a href=\"http:\/\/en.wikipedia.org\/wiki\/SQL_injection\" target=\"_blank\">SQL Injection<\/a> attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate on java web application. <a href=\"http:\/\/www.applicure.com\/blog\/owasp-top-10-2010\" target=\"_blank\">Open Web Application Security Project(OWAP)<\/a> listed that SQL Injection is the top vulnerability attack for web application. Hacker&#8217;s Inject the SQL code in web request to the web application and take the control of back end database, even that back end database is not directly connected to Internet. And we will see how to solve and prevent the SQL Injection in java Web Application.<\/p>\n<p>For this purpose we need 1 tools. these tool are completely open source.\u00a0SQL Map &#8211; SqlMap is an open source penetration testing tool that automates the process of detecting and exploiting SQL Injection. we can get it from <a href=\"http:\/\/sqlmap.sourceforge.net\/\" target=\"_blank\">here<\/a>.<\/p>\n<p><span style=\"text-decoration: underline;\">SQLInjection<\/span><\/p>\n<p>SQL injection is the technique to extract the database information through web application.<br \/>\nScenario:<\/p>\n<p><em>We have one database server [MySQL] and web application server [Tomcat]. consider that database server is not connected to internet. but its connected with application server. Now we will see using web application how to extract the information using sql-injection method.<\/em><\/p>\n<p>Before see the sql-injection, we create small web application. It contain single jsp page like this<\/p>\n<pre class=\"brush:xml\">&lt;form action='userCheck'&gt;\r\n\r\n&lt;input type='text' name='user' value=''\/&gt;\r\n\r\n&lt;input type='submit' value='Submit'\/&gt;\r\n\r\n&lt;\/form&gt;\r\n<\/pre>\n<p>In userCheck Servlet receives the user input field and connect to databse server and fire the sql query based on user input and receive the ResultSet and iterate it print into the web page.<br \/>\n<span style=\"text-decoration: underline;\">userCheck servlet<\/span><\/p>\n<pre class=\"brush:java\">protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {\r\n        response.setContentType('text\/html;charset=UTF-8');\r\n        PrintWriter out = response.getWriter();\r\n        try {\r\n\r\n            String user = request.getParameter('user');\r\n            Connection conn = null;\r\n            String url = 'jdbc:mysql:\/\/192.168.2.128:3306\/';\r\n            String dbName = 'anvayaV2';\r\n            String driver = 'com.mysql.jdbc.Driver';\r\n            String userName = 'root';\r\n            String password = '';\r\n            try {\r\n                Class.forName(driver).newInstance();\r\n                conn = DriverManager.getConnection(url + dbName, userName, password);\r\n\r\n                Statement st = conn.createStatement();\r\n                String query = 'SELECT * FROM  User where userId='' + user + ''';\r\n                out.println('Query : ' + query);\r\n                System.out.printf(query);\r\n                ResultSet res = st.executeQuery(query);\r\n\r\n                out.println('Results');\r\n                while (res.next()) {\r\n                    String s = res.getString('username');\r\n                    out.println('\\t\\t' + s);\r\n                }\r\n                conn.close();\r\n\r\n            } catch (Exception e) {\r\n                e.printStackTrace();\r\n            }\r\n        } finally {\r\n            out.close();\r\n        }<\/pre>\n<p>When we execute the above code. In normal input execution look like follows<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-3711\" title=\"sample_application\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application-300x150.png\" alt=\"\" width=\"300\" height=\"150\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application-300x150.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application.png 402w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>When we give the normal value like &#8216;ramki&#8217; then click the submit button then output like this<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application_output.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-3712\" title=\"sample_application_output\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application_output-300x131.png\" alt=\"\" width=\"300\" height=\"131\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application_output-300x131.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sample_application_output.png 522w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Its perfectly correct in normal behaviour. What happens when I put some special character or some sql statement in input box like this<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-3713\" title=\"sql_injection\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection-300x155.png\" alt=\"\" width=\"300\" height=\"155\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection-300x155.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection.png 374w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>when we click the submit button then it show all rows in my table like this<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection_output.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-3714\" title=\"sql_injection_output\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection_output-300x152.png\" alt=\"\" width=\"300\" height=\"152\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection_output-300x152.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/11\/sql_injection_output.png 627w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It is a big security breach in my application. what happened&#8230; is one kind of sql injection.<\/p>\n<p>Let&#8217;s see what happened.<\/p>\n<p>When I enter normal value in input box my servlet receives and substitute in the sql query and execute it.<\/p>\n<pre class=\"brush:bash\">SELECT * FROM User where userId='ramki'<\/pre>\n<p>it&#8217;s correct and we got correct output.<\/p>\n<p>What happens when I put sdfssd&#8217; or &#8216;1&#8217;=&#8217;1<\/p>\n<p>SELECT * FROM User where userId =&#8217;<span style=\"text-decoration: underline;\">sdfssd&#8217; or &#8216;1&#8217;=&#8217;1<\/span>&#8216;<\/p>\n<p>its means<\/p>\n<pre class=\"brush:bash\">SELECT * FROM User where userId ='sdfssd' or '1'='1'<\/pre>\n<p>like this. So our query is altered. now new query have 2 condition. 2nd condition always true. 1st condition may be or may not be true. but these 2 condition are connected with or logic. So where clause always true for all rows. the result is they bring all rows from our tables.<\/p>\n<p>This is called blind sql injection. If u want more details of sql injection the check here<\/p>\n<ul>\n<li><a href=\"http:\/\/www.unixwiz.net\/techtips\/sql-injection.html\">http:\/\/www.unixwiz.net\/techtips\/sql-injection.html<\/a><\/li>\n<li><a href=\"http:\/\/www.imperva.com\/resources\/glossary\/sql_injection.html\">http:\/\/www.imperva.com\/resources\/glossary\/sql_injection.html<\/a><\/li>\n<li><a href=\"http:\/\/www.applicure.com\/blog\/owasp-top-10-2010\">http:\/\/www.applicure.com\/blog\/owasp-top-10-2010<\/a><\/li>\n<\/ul>\n<p>Now we can enter the sql statement directly in input box<\/p>\n<p>like<\/p>\n<p>ramki&#8217; UNION SELECT * FROM mysql.`user` u &#8212;<\/p>\n<p>then<\/p>\n<p>SELECT * FROM User where userId=&#8217;<span style=\"text-decoration: underline;\">ramki&#8217; UNION SELECT * FROM mysql.`user` u &#8212;<\/span>&#8216;<\/p>\n<p>then its means<\/p>\n<pre class=\"brush:bash\">SELECT * FROM User where userId ='ramki' UNION SELECT * FROM mysql.`user` u --'<\/pre>\n<p>Here they wont use * because its not matched with first table. So they find how many columns then use Union with second table.the user particular column they want. As result the get mysql database user information its exposed through our web application.<\/p>\n<p><strong>sqlmap<\/strong><\/p>\n<p>It comes with a powerful detection engine, many niche features for the ultimate penetration tester and a broad range of switches lasting from database fingerprinting, over data fetching from the database<\/p>\n<p>Install the sqlmap in ur system or use <a href=\"http:\/\/www.backtrack-linux.org\/\" target=\"_blank\">BackTrack Linux<\/a><\/p>\n<p>Here I used backtrack linux, because it&#8217;s already pre installed lots of applications like sqlmap.<\/p>\n<p>In backtrack, sqlmap is located in \/pentest\/web\/scanner\/sqlmap<\/p>\n<p><strong><em><span style=\"text-decoration: underline;\">sqlmap commands<\/span><\/em><\/strong><\/p>\n<p>retrieve all databases<\/p>\n<pre class=\"brush:bash\">.\/sqlmap.py -u http:\/\/localhost:8080\/SQLInject\/userCheck?user=ramki --dbs<\/pre>\n<p>retrieve all tables<\/p>\n<pre class=\"brush:bash\">.\/sqlmap.py -u http:\/\/localhost:8080\/SQLInject\/userCheck?user=ramki -D test --tables<\/pre>\n<p>retrieve all columns from particular table<\/p>\n<pre class=\"brush:bash\">.\/sqlmap.py -u http:\/\/localhost:8080\/SQLInject\/userCheck?user=ramki -D test -T User --columns<\/pre>\n<p>Dump all column valued from particular table<\/p>\n<pre class=\"brush:bash\">.\/sqlmap.py -u http:\/\/localhost:8080\/SQLInject\/userCheck?user=ramki -D test -T User --dump<\/pre>\n<p>Dump some column valued from particular table<\/p>\n<pre class=\"brush:bash\">.\/sqlmap.py -u http:\/\/localhost:8080\/SQLInject\/userCheck?user=ramki -D test -T User -C userId,password --dump<\/pre>\n<p>See the video for full demo (watch in HD):<\/p>\n<p><a href=\"http:\/\/www.youtube.com\/watch?feature=player_embedded&amp;v=C5PQ86nWMkM  \">http:\/\/www.youtube.com\/watch?feature=player_embedded&amp;v=C5PQ86nWMkM<\/a><\/p>\n<p><strong>How To Prevent SQL Injection<\/strong><\/p>\n<ul>\n<li>Before substitute into query, we need to do the validation. for remove ir escaped the special character like single quote, key words like select, Union&#8230;<\/li>\n<li>Use Prepared Statement with placeholder<\/li>\n<\/ul>\n<pre class=\" brush:java\">PreparedStatement  preparedStatement=conn.prepareStatement('SELECT * FROM  usercheck where username=?') ;\r\npreparedStatement.setString(1, user);<\/pre>\n<p>that setXXX() method do all the validation and escaping the special charcter<\/p>\n<p>Now if use same blind sql injection like<\/p>\n<p>sdfssd&#8217; or &#8216;1&#8217;=&#8217;1 then<\/p>\n<pre class=\"brush:bash\">SELECT * FROM User where userId='sdfssd\\' or \\'1\\'=\\'1'<\/pre>\n<p>Here all special character are escaped When we use JPA kind of ORM tools like Hibernate, EclipseLink, TopLink that time also may be sqlinjection is possible.<\/p>\n<p>To prevent the SQL injection we need to use NamedQuery instead of normal Query. Because NamedQuery internally used PreparedStement but normal query used norma Stement in java.<\/p>\n<p>Normal Query in JPA<\/p>\n<pre class=\" brush:java\">String q='SELECT r FROM  User r where r.userId=''+user+''';\r\nQuery query=em.createQuery(q);\r\nList users=query.getResultList();<\/pre>\n<p>So don&#8217;t use normal query, use Named query like this<\/p>\n<pre class=\" brush:java\">Query query=em.createNamedQuery('User.findByUserId');\r\nquery.setParameter('userId', user);\r\nList users=query.getResultList();<\/pre>\n<p>&nbsp;<br \/>\n<strong>U can download the demo code from <a href=\"https:\/\/github.com\/ramkicse\/Sql-Injection-in-Java.git\" target=\"_blank\">GitHub<\/a> (or) <a href=\"http:\/\/ramki-projects.googlecode.com\/files\/Sqlinjection.zip\" target=\"_blank\">Google code<\/a><\/strong><br \/>\n&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/www.ramkitech.com\/2011\/12\/beware-of-sqlinjection-in-java.html\">Beware of SQLInjection in Java Application<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Rama Krishnan at the <a href=\"http:\/\/www.ramkitech.com\/\">Ramki Java Blog<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate on java web application. Open Web Application Security Project(OWAP) listed that SQL Injection is the top vulnerability attack for web application. Hacker&#8217;s Inject the SQL code in &hellip;<\/p>\n","protected":false},"author":53,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[297],"class_list":["post-3709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-security"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Injection in Java Application<\/title>\n<meta name=\"description\" content=\"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Injection in Java Application\" \/>\n<meta property=\"og:description\" content=\"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ramkicse\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-27T20:00:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-11-27T21:18:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ramki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/ramkicse\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ramki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html\"},\"author\":{\"name\":\"Ramki\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9d589524ba2e652ec80d90580bed4f6e\"},\"headline\":\"SQL Injection in Java Application\",\"datePublished\":\"2012-11-27T20:00:10+00:00\",\"dateModified\":\"2012-11-27T21:18:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html\"},\"wordCount\":833,\"commentCount\":8,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Security\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html\",\"name\":\"SQL Injection in Java Application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-11-27T20:00:10+00:00\",\"dateModified\":\"2012-11-27T21:18:55+00:00\",\"description\":\"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/11\\\/sql-injection-in-java-application.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"SQL Injection in Java Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/9d589524ba2e652ec80d90580bed4f6e\",\"name\":\"Ramki\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g\",\"caption\":\"Ramki\"},\"description\":\"Ramki is a Application Developer working in the C-DAC, Pune. He has Extensive Design and Development experience in Java, Java Server Faces, Servlets, Java Persistent API (Hibernate), CDI, EJB and experience in applying Design Patterns of JavaEE Architecture.\",\"sameAs\":[\"http:\\\/\\\/www.ramkitech.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/ramkicse\",\"http:\\\/\\\/in.linkedin.com\\\/in\\\/ramkicse\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/ramkicse\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Rama-Krishnan\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Injection in Java Application","description":"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html","og_locale":"en_US","og_type":"article","og_title":"SQL Injection in Java Application","og_description":"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate","og_url":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/ramkicse","article_published_time":"2012-11-27T20:00:10+00:00","article_modified_time":"2012-11-27T21:18:55+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Ramki","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/ramkicse","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ramki","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html"},"author":{"name":"Ramki","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9d589524ba2e652ec80d90580bed4f6e"},"headline":"SQL Injection in Java Application","datePublished":"2012-11-27T20:00:10+00:00","dateModified":"2012-11-27T21:18:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html"},"wordCount":833,"commentCount":8,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Security"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html","url":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html","name":"SQL Injection in Java Application","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2012-11-27T20:00:10+00:00","dateModified":"2012-11-27T21:18:55+00:00","description":"In this post we will discuss what is an SQL Injection attack. and how its may affect\u00a0any web application its use the back end database. Here i concentrate","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/11\/sql-injection-in-java-application.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"SQL Injection in Java Application"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/9d589524ba2e652ec80d90580bed4f6e","name":"Ramki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf263b837c98d3f2f91ce7487827be5bce829b02a70b7f6b4b752e77b390b442?s=96&d=mm&r=g","caption":"Ramki"},"description":"Ramki is a Application Developer working in the C-DAC, Pune. He has Extensive Design and Development experience in Java, Java Server Faces, Servlets, Java Persistent API (Hibernate), CDI, EJB and experience in applying Design Patterns of JavaEE Architecture.","sameAs":["http:\/\/www.ramkitech.com\/","https:\/\/www.facebook.com\/ramkicse","http:\/\/in.linkedin.com\/in\/ramkicse","https:\/\/x.com\/http:\/\/twitter.com\/ramkicse"],"url":"https:\/\/www.javacodegeeks.com\/author\/Rama-Krishnan"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/3709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=3709"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/3709\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=3709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=3709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=3709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}