Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy result set is empty
    primarykey
    data
    text
    <pre><code>String name = request.getParameter("type"); String queryString = "SELECT * FROM Customer WHERE TYPE='Provider';"; rs = statement.executeQuery(queryString); while(rs.next()) out.print(rs.getString(2)); </code></pre> <p>prints nothing, why? I checked the DB connection but i'm connected to it successfully. What might be the problem?</p> <p>whole code in jsp. I think there is a problem with whole code. What is the problem here?</p> <pre><code>&lt;%@page import="java.sql.Statement"%&gt; &lt;%@page import="java.sql.ResultSet"%&gt; &lt;%@page import="java.sql.DriverManager"%&gt; &lt;%@page import="java.sql.Connection"%&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;GET CUSTOMER LIST&lt;/title&gt;&lt;meta name="keywords" content="contact, direction,"&gt;&lt;meta name="description" content=""&gt; &lt;meta name="HandheldFriendly" content="True"&gt; &lt;meta name="MobileOptimized" content="320"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"&gt; &lt;meta name="format-detection" content="telephone=no"&gt; &lt;meta name="format-detection" content="address=no"&gt; &lt;link rel="canonical" href="#"&gt; &lt;link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://www.onbile.com/nbproject/private/sushi/media/icon/apple-touch-icon.png"&gt; &lt;link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://www.onbile.com/nbproject/private/sushi/media/icon/apple-touch-icon.png"&gt; &lt;link rel="apple-touch-icon-precomposed" href="http://www.onbile.com/nbproject/private/sushi/media/icon/apple-touch-icon-precomposed.png"&gt; &lt;link rel="shortcut icon" href="http://www.onbile.com/nbproject/private/sushi/media/icon/apple-touch-icon.png"&gt; &lt;!-- Mobile IE ows us to activate ClearType technology for smoothing fonts for easy reading --&gt; &lt;meta http-equiv="cleartype" content="on"&gt; &lt;link rel="shortcut icon" href="http://www.onbile.com/favicon.ico"&gt; &lt;style type="text/css" media="screen"&gt; /*reset*/ html, body { margin: 0; padding: 0; border: 0; } body { font-family:Helvetica, Arial, sans-serif; line-height:1.5; font-size:16px; background: #fff; color: #333; word-wrap: break-word; -webkit-text-size-adjust: none; } h1, h2, h3, h4, h5, h6{ font-weight: normal; margin: 0;} p img { float: left; margin: 0 10px 5px 0; padding: 0; } img { border: 0; max-width: 100%; } table { width:auto; border-collapse: collapse;border-spacing: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } /*Non-semantic helper classes*/ .ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; } .ir br { display: none; } @font-face { font-family: 'FagoCoRegular'; src: url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-webfont.eot'); src: url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-webfont.eot?#iefix') format('embedded-opentype'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-webfont.woff') format('woff'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-webfont.ttf') format('truetype'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-webfont.svg#') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'FagoCoBlackRegular'; src: url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-black-webfont.eot'); src: url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-black-webfont.eot?#iefix') format('embedded-opentype'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-black-webfont.woff') format('woff'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-black-webfont.ttf') format('truetype'), url('http://www.onbile.com/nbproject/private/sushi/media/font/fagoco-black-webfont.svg#FagoCoBlackRegular') format('svg'); font-weight: normal; font-style: normal; } body { font-family: 'FagoCoRegular'; } h2.title1 { padding: 22px 15px 20px 15px; line-height: 0.9em; } .title2 { line-height: 0.9em; } .title4 { letter-spacing: -0.05em; line-height: 1.2em; } img.image { padding: 1px 0; display: block; width: 100%; } .imgcontent { position: relative; overflow: hidden; border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; } img.image.left { float: left; } img.image.right { float: right; } img.image.center { margin: 0 auto; } .order { margin-bottom: 1px; border-bottom-style: solid; border-bottom-width: 1px; display: block; padding: 4px; } &lt;/style&gt; &lt;link rel="stylesheet" href="http://www.onbile.com/assets/websites/final/052/333/052333/css/52333_f.css"&gt;&lt;link rel="stylesheet" href="http://www.onbile.com/assets/websites/final/052/333/052333/css/52333_c.css"&gt; &lt;!--[if gte IE 8.0]&gt; &lt;style type="text/css"&gt; .t-sushi-p-gallery-content .list-items li { width: 46%; } &lt;/style&gt; &lt;![endif]--&gt; &lt;script src="http://www.onbile.com/nbproject/private/sushi//js/modernizr.custom.09105.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;header class="t-sushi-p-header int"&gt; &lt;div class="header"&gt; &lt;span class="adorn"&gt;&lt;/span&gt; &lt;a href="http://tekirmobile.onbile.com/" class="btn back ir"&gt;back&lt;/a&gt; &lt;h1 class=""&gt;&lt;a href="http://tekirmobile.onbile.com/" id="logotype"&gt;&lt;img src="http://www.onbile.com/assets/websites/final/052/333/052333/smooth_logo.png" class=" center" style="width:60%;"&gt;&lt;/a&gt;&lt;/h1&gt; &lt;a href="#" class="btn menu ir"&gt;menu&lt;/a&gt; &lt;a href="#container" class="btn menu ir on"&gt;menu&lt;/a&gt; &lt;/div&gt; &lt;/header&gt; &lt;header class="t-sushi-p-subtitle"&gt; &lt;p title="My own profile" class="subtitle edit_element" id="1688529_subtitle" type="text"&gt;My own profile&lt;/p&gt; &lt;/header&gt; &lt;style&gt; #container:target nav.t-sushi-p-menu.acor ul { height: 160px; } &lt;/style&gt; &lt;nav class="t-sushi-p-menu acor"&gt; &lt;ul&gt; &lt;li class="selected"&gt;&lt;a href="http://127.0.0.1/getCustomerList.html" class="menu"&gt;GET CUSTOMER LIST&lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="http://tekirmobile.onbile.com//about-me" class="menu"&gt;MONITOR CASH FLOW&lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="http://tekirmobile.onbile.com//curriculum-vitae" class="menu"&gt;GET CUSTOMER STATE INFO&lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="http://tekirmobile.onbile.com//photo-gallery" class="menu"&gt;MONITOR FINANCIAL TRANSACTIONS&lt;/a&gt;&lt;/li&gt;&lt;li class=""&gt;&lt;a href="http://tekirmobile.onbile.com//blog" class="menu"&gt;GET PAYMENT PLAN&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;div class="t-sushi-p-contact-content"&gt; &lt;!-- &lt;h2 title="Contact with Mike Stain" class="title1 edit_element" id='1688531_titles' type='text'&gt;Contact with Mike Stain&lt;/h2&gt; --&gt; &lt;h2 class="title1"&gt;GET CUSTOMER LIST&lt;/h2&gt; &lt;form name="input" action="/TekirMobile/getCustomerList" method="post"&gt; &lt;table&gt; &lt;div class="prop"&gt; &lt;span class="value "&gt;&lt;select name="type" class="middle" size="1"&gt; &lt;option value="All"&gt;All&lt;/option&gt; &lt;option value="Customer" selected="selected"&gt;Customer&lt;/option&gt; &lt;option value="Provider"&gt;Provider&lt;/option&gt; &lt;option value="Bank"&gt;Bank&lt;/option&gt; &lt;option value="Foundation"&gt;Foundation&lt;/option&gt; &lt;option value="Agent"&gt;Agent&lt;/option&gt; &lt;option value="Branch"&gt;Branch&lt;/option&gt; &lt;option value="Contact"&gt;Contact&lt;/option&gt; &lt;option value="Related"&gt;Related&lt;/option&gt; &lt;option value="Personnel"&gt;Personnel&lt;/option&gt; &lt;/select&gt; &lt;/span&gt; &lt;/div&gt; &lt;/table&gt; &lt;br /&gt; &lt;input type="submit" value="Search" name="submit"&gt; &lt;% try { /* Create string of connection url within specified format with machine name, port number and database name. Here machine name id localhost and database name is usermaster. */ String connectionURL = "jdbc:mysql://localhost:3306/TekirMobile"; // declare a connection by using Connection interface Connection connection = null; // Load JBBC driver "com.mysql.jdbc.Driver" Class.forName("com.mysql.jdbc.Driver").newInstance(); /* Create a connection by using getConnection() method that takes parameters of string type connection url, user name and password to connect to database. */ connection = DriverManager.getConnection(connectionURL, "root", "fenderpass"); ResultSet rs = null; Statement statement = null; if(request.getParameter("submit")!=null) { String name = request.getParameter("type"); String queryString = "SELECT * FROM Customer WHERE TYPE='Provider'"; out.print(queryString); rs = statement.executeQuery(queryString); for (int i = 1; rs.next(); i++) { out.println("row=" + i + ": " + rs.getString(2)); } } // check weather connection is established or not by isClosed() method if(!connection.isClosed()) %&gt; &lt;font size="+3" color="green"&gt;&lt;/b&gt; &lt;% connection.close(); } catch(Exception ex){ %&gt; &lt;/font&gt; &lt;font size="+3" color="red"&gt;&lt;/b&gt; &lt;% } %&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;footer class="t-sushi-p-footer"&gt; &lt;h5 title="" class="title5 edit_element" id="1688532_title_contact" type="text"&gt;&lt;/h5&gt; &lt;div class="small edit_element" id="1688532_contact_description" type="textarea"&gt;&lt;p&gt;©2012 | License | Privacy | Özgür Yaz?l?m&amp;nbsp;&lt;/p&gt;&lt;/div&gt; &lt;/footer&gt; &lt;div class="t-sushi-p-social"&gt; &lt;ul class="social"&gt; &lt;li class="facebook" id="facebook_elem"&gt; &lt;a href="http://www.facebook.com/" class="" target="_blank"&gt;Facebook&lt;/a&gt; &lt;/li&gt;&lt;li class="twitter" id="twitter_elem"&gt; &lt;a href="http://www.twitter.com/" class="" target="_blank"&gt;Twitter&lt;/a&gt; &lt;/li&gt;&lt;li class="linkedin" style="display:none" id="linkedin_elem"&gt; &lt;a href="http://www.linkedin.com/" class="" target="_blank"&gt;Your Linkedin&lt;/a&gt; &lt;/li&gt;&lt;li class="skype" style="display:none" id="skype_elem"&gt; &lt;a href="http://www.skype.com/" class="" target="_blank"&gt;Your Skype&lt;/a&gt; &lt;/li&gt;&lt;li class="flickr" style="display:none" id="flickr_elem"&gt; &lt;a href="http://www.flickr.com/" class="" target="_blank"&gt;Your Flickr&lt;/a&gt; &lt;/li&gt;&lt;li class="youtube" style="display:none" id="youtube_elem"&gt; &lt;a href="http://www.youtube.com/" class="" target="_blank"&gt;Your Youtube&lt;/a&gt; &lt;/li&gt;&lt;li class="google" style="display:none" id="google_elem"&gt; &lt;a href="http://www.google.com/" class="" target="_blank"&gt;Your Google&lt;/a&gt; &lt;/li&gt;&lt;li class="email" style="display:none" id="email_elem"&gt; &lt;a href="mailto:" class="" target="_blank"&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--! end of #container --&gt; &lt;div style="height:51px;width:100%;clear:both"&gt;&amp;nbsp;&lt;br&gt;&lt;/div&gt; &lt;div style="position:fixed; bottom:0px;margin-left:auto;margin-right:auto"&gt; &lt;!--qzkqc--&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload