Separate the two problems. First find out how to scan barcodes, and what the result type is (
String, int, byte[], ?). Focus on inserting after that. After all, you can scan barcodes and just display the results, and you can insert almost anything into a database. They really are two separate problems that come together in your application.