Estamos trabajando en un proyecto de almacenamiento de archivos en la "nube" mediante el uso de Java y conexión mediante sockets.
Tenemos como insertar valores en la BBDD (en este caso se inserta 'hello' en la posición 1 de la tabla 'msg')
public static void main(String[] args) {
try {
Connection con = DriverManager.getConnection(
"jdbc:sqlite:sample.db");
Statement stmt = con.createStatement();
stmt.executeUpdate("CREATE TABLE msg(id INT, content TEXT)");
int count = stmt.executeUpdate("INSERT INTO msg VALUES(1, 'hello')");
ResultSet rs = stmt.executeQuery("SELECT * FROM msg");
while (rs.next()) {
int x = rs.getInt(1);
String s = rs.getString(2);
System.out.println(x + " - " + s);
}
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
La duda surge a la hora de insertar archivos de cualquier tipo (texto, imágenes, etc...) en la BBDD.
Si alguien puede aportar la metodología para realizar nuestro propósito nos hará un gran favor. Muchas gracias.