Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExtraOefening1 {
- public static void main(String[] args) {
- Connection con = Oefening7.getConnection();
- try {
- PreparedStatement s = con.prepareStatement("INSERT INTO Images(imgName,img) VALUES(?,?)");
- File fBlob = new File("src/main/resources/bmp.bmp");
- FileInputStream is = new FileInputStream(fBlob);
- s.setString(1, "image");
- s.setBlob(2, is);
- s.executeUpdate();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
- public class Oefening6 {
- public static Connection getConnection() {
- try {
- Connection con = DriverManager.getConnection("jdbc:mysql://db4free.net/pxlboyen", "root12", "root12");
- return con;
- } catch (Exception ex) {
- System.out.println("oops");
- ex.printStackTrace(System.err);
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement