I am trying this method to add database content through the JDBC, But having lot of trouble in this process but Can anyone tell me whether storing a data through the byte array to the database with JDBC is possible.
I am trying this method to add database content through the JDBC, But having lot of trouble in this process but Can anyone tell me whether storing a data through the byte array to the database with JDBC is possible.
You need to use a PreparedStatement rather than a regular statement since Java and SQL won't let you write out a list of bytes. To access an Oracle Lite database, your Java program must first load the Oracle Lite JDBC driver and then establish a connection to the database. Compared to Spring JDBC, iBatis is a higher level of abstraction that handles more work for you without placing any restrictions on what you can do.
I can build the ImageIcon before it goes to the database and i can successfully write the image to a file from Access using a FIleOutputStream, to confirm it is stored correctly. The Class.forName method finds, loads, and links the referenced Oracle Lite JDBC driver class. You do not need to explicitly create an instance of the POLJDBCDriver class. An instance of the POLJDBCDriver class is automatically created and registered with the JDBC driver manager when you call Class.forName.
Using straight JDBC (or presumably Spring JDBC), I can get an InputStream on the file and tell a PreparedStatement object to use the stream as a bind variable. To call a stored procedure using the executeQuery method, first create a Statement object, which you assign the value returned by the createStatement method of the current connection object. iBatis doesn't seem to know how to deal with InputStreams as parameters.
Bookmarks