title: Can getString() method of ResultSet can be used for getting the value of a TEXT type column from a MySQL table?
body: <p>I am trying to retrieve the value of a TEXT field from a table in a MySQL database.
  MySQL version is 5.6.21
  &amp; I am using mysql-connector-java-5.1.18-bin.jar</p>
  
  <p>My file is given below</p>
  
  <pre><code>import java.sql.*;
  
  public class DatabaseConnection {
  
      static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
      static final String DB_URL = "jdbc:mysql://localhost/book";
  
      // database credentials
      static final String USER = "username";
      static final String PASS = "password";
  
      public static void main(String[] args) {
          Connection conn = null;
          Statement stmt = null;
          try {
  
              Class.forName("com.mysql.jdbc.Driver");
  
              System.out.println("Connecting to database...");
              conn = DriverManager.getConnection(DB_URL, USER, PASS);
  
              System.out.println("Creating statement...");
              stmt = conn.createStatement();
              String query;
              query = "Select b_name, description columns from brands";
              ResultSet rs = stmt.executeQuery(query);
  
              while(rs.next()) {
  
                  String first_name = rs.getString("b_name");
                  String description = rs.getString("description");
  
                  System.out.println(first_name);
                  System.out.println(description);
              }
  
              rs.close();
              stmt.close();
              conn.close();
          } catch(SQLException se) {
              se.printStackTrace();
          } catch(ClassNotFoundException cnfe) {
              cnfe.printStackTrace();
          }
          finally{
              //finally block used to close resources
              try{
                  if(stmt!=null)
                      stmt.close();
              } catch(SQLException se2){
              }// nothing we can do
              try{
                  if(conn!=null)
                      conn.close();
              } catch(SQLException se){
                  se.printStackTrace();
              }//end finally try
          }//end try
          System.out.println("Goodbye!");
      }
  }
  </code></pre>
  
  <p>This says that my column does not exist although I have tried this on another table, it works on VARCHAR columns but not on TEXT columns</p>
  
  <p>This error shows up: <img src="https://i.stack.imgur.com/1TNkQ.jpg" alt=""></p>
  
  <p>But the table has a column named description: <img src="https://i.stack.imgur.com/bCOSs.jpg" alt=""></p>