How to get Image from Database(MySQL) using Java in NetBeansIDE

How to get Image from Database(MySQL) in Java with NetBeansIDE.

Note: Image is of Blob/LongBlob type in Database.

1. Open NetBeansIDE.

2. In your project make a JFrame form (say NewForm)

2.1 Add a button and a label(to display the image) in it.

3. Right Click on Button and Goto Events~action~actionPerformed

3.1 In actionPerformed method write code for connection.
3.2 Get the image in Byte array.

4. Import mysql connector jar file.

5. Run the JFrame Form file.

6. Finish.

Facebook Page: https://www.facebook.com/raksrahuljava

Blog : http://raksrahul.blogspot.in/

source