-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageInsertAlgo.java
More file actions
38 lines (33 loc) · 1.14 KB
/
ImageInsertAlgo.java
File metadata and controls
38 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class ImageInsertAlgo {
public static void main(String[] args) {
insertMainImage();
}
public static void insertMainImage()
{
try {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/22acres", "root", "root");
String sql = "insert into society_gallery (image_name,image,society_id) values(?,?,?)";
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, "1");
preparedStatement.setString(2, "C:\\Users\\SHAIL\\Desktop\\main supercity\\1.jpeg");
preparedStatement.setInt(3, 1);
int rows= preparedStatement.executeUpdate();
connection.close();
// response.sendRedirect("societyList.jsp");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void insertAmenitiesImage()
{
}
}