0
I am creating an application using Angularjs and using webservlets with mysql database connection.
To generate the binary, I use the following code:
$scope.adicionarArquivo = function (element) {
var reader = new FileReader();
reader.readAsDataURL(element.files[0]);
setTimeout(function () {
$scope.itemSelecionado.arquivo = reader.result;
}, 1000);
};
The binary is generated correctly and I can display the image in an IMG tag. The problem occurs when I save it in the database. First how do I store this binary in java to pass in mysql? And, what variable do I create in the database, blob? Binary?
Are you using any framework in your back-end, like Spring, or is JDBC even pure? The column in the database should be BLOB itself.
– StatelessDev
would be pure JDBC even, I changed the column to longblob. I managed to solve by setting straight on longblob, it would be the best way?
– Alexandre Nobre
BLOB = 64KB, MEDIUMBLOB = 16MB and LONGBLOB = 4GB... Caution when using longblob
– Thiago Bomfim