title: Java - save and/or retrieve a byte from an sql database
body: <p><a href="https://i.stack.imgur.com/dRyvl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dRyvl.png" alt="This is my java code which includes the sql which is executed"></a></p>
  
  <p><a href="https://i.stack.imgur.com/SqaPx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SqaPx.png" alt="This is the sql code that originally created the table"></a></p>
  
  <p>I know at the moment, the password is just saved as it is in the database,
  but I want it to be saved as an encrypted byte array (e.g. [@7aC&amp;s ).
  I have the password set as a varbinary, but when I tried to save the password as a byte[] using the getBytes() method, it retrieved the [@7aC&amp;s as a String and not a byte[].
  I want to do this so I can then use the new String(byte[]) to decrypt it back into a String.</p>
  
  <p>How can I do this, or can I not do it at all?<br>
  <strong>EDIT:</strong>
  If you're wondering what the new MySQLConnnector(); is, here it is:
  <a href="https://i.stack.imgur.com/vEH5k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vEH5k.png" alt="MySQLConnector.java"></a></p>