adspace
Can you insert and retrive images in msaccess using java? If yes, how?
Answer Posted / Anand Kumar Jha
Yes, it is possible to insert and retrieve images in MS Access using Java. This requires using the JDBC (Java Database Connectivity) API with an ODBC driver for MS Access. Here's a simplified example of retrieving an image:
// Load the driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Establish connection
Connection con = DriverManager.getConnection("jdbc:odbc:DatabaseName");
// Prepare and execute a query to get the image
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ImageColumn FROM TableName WHERE ID = 1");
Blob blob = rs.getBlob(1);
// Convert the Blob to an InputStream and read the image data
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers