{"id":1920,"date":"2022-08-30T15:20:33","date_gmt":"2022-08-30T15:20:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/update-existing-database-entry-in-java-app-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:33","modified_gmt":"2022-08-30T15:20:33","slug":"update-existing-database-entry-in-java-app-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/update-existing-database-entry-in-java-app-collection-of-common-programming-errors\/","title":{"rendered":"Update existing database entry in java App-Collection of common programming errors"},"content":{"rendered":"<p>I am currently trying to make an update application (Java based) that the user can go through and view the existing database entries (MySQL) and edit them if need be&#8230; I was wondering how to get the information for a specific entry (ie 12-1589 which is an example of what the ID or primary key would be) and fill in the text boxes with all of the information from said entry&#8230;. I may just need to walk away from the computer for a bit because i may be over-thinking it, but I don&#8217;t know&#8230;<\/p>\n<p>mainly i am unsure with the exact code that you would use to move to that entry and retrieve the data from just that entry&#8230;. I know how to step trough a database one entry at a time, but i would rather just jump to a specific row based off of an id number (such as above 12-1589) if at all possible&#8230;.<\/p>\n<p>I just tried this and i recieved an error&#8230;. The error was: &#8220;Unknown column &#8217;12-1859&#8242; in &#8216;where clause'&#8221;<\/p>\n<pre><code>con = DriverManager.getConnection(host, uName, uPass);\nstmt = con.createStatement();       \nString sql = \"SELECT * FROM Load_Sheet WHERE Load_Number = 12-1859 limit 1\";\nrs = stmt.executeQuery(sql);\nString BC = rs.getString(\"BC\");\n<\/code><\/pre>\n<p>If anyone could give me a hand with that is going wrong i would appreciate it&#8230;<\/p>\n<p>I just started getting another error along with the other one&#8230; it is : &#8220;illegal operation on empty result set&#8221;<\/p>\n<p>Though the result sets are not empty so my guess is, is that i am missing a step somewhere&#8230;.<\/p>\n<ol>\n<li>\n<p>What you need is a simple <code>WHERE<\/code> statement if i understood correctly your question.<\/p>\n<pre><code>SELECT * FROM table_name WHERE entry_col = \"12-1589\" LIMIT 1\n<\/code><\/pre>\n<p><code>LIMIT 1<\/code> is only added so that the <code>MySql<\/code> query only returns a single row.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-02 21:18:19. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am currently trying to make an update application (Java based) that the user can go through and view the existing database entries (MySQL) and edit them if need be&#8230; I was wondering how to get the information for a specific entry (ie 12-1589 which is an example of what the ID or primary key [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1920","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1920"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1920\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}