title: How to overcome lexical error while accessing mainframe via jdbc?
body: <p>I'm able to connect to IMS segments and do sql queries with primary key in where clause and select * queries. But whenever I'm trying to do a select with another column I get a lexical error.</p>
  
  <pre><code>Select * from table where column-name='something'
  </code></pre>
  
  <p>This would give me the exception <strong>'Exception in thread "main" com.ibm.ims.jdbc.TokenMgrError: Lexical error at line 1, column 42.  Encountered: "-" (45), after : ""'</strong>. If I have the column name as first-name, then the lexical error would occur at position of hyphen in first-name. I've tried doing this via Prepared Statement and it still does not work. </p>
  
  <p>After doing the following changes, I still get exceptions.
  Select * from table where 'column-name'='something'
  <strong>Caused by: com.ibm.ims.jdbc.ParseException: Encountered "  "\'column-name\' "" at line 1, column 36.
  Was expecting one of:
       ...
      "(" ..</strong>.</p>
  
  <p>Select * from table where column+'-'+name='something'
  Exception of lexical error with '-'</p>
  
  <p>Invalid escape sequence (valid ones are  \b  \t  \n  \f  \r  \"  \'  \ ), this is the message I get when I'm trying for adding backticks or some escape sequences. </p>