Friday, January 19, 2018

Java MySQL SELECT (using Statement)

See also: MySQL XAMPP Connection for Java jdbc Program

Let's see the following table:



Now follow these steps:

  • Create a Java Connection to our MySQL database.
  • Define SQL SELECT statement.
  • Then execute the SELECT query, getting a Java ResultSet from that query
  • Now iterate over the ResultSet, getting the database fields (columns) from each row of data that is returned
  • Close our Java MySQL database connection.
  • Finally catch any SQL exceptions using try-catch clause.


See also:
Reference

No comments:

Post a Comment