|
| |||||||||
| Tags: byte array, database connectivity, jdbc, windows |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to store byte array to database with JDBC?
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. |
|
#2
| |||
| |||
| Re: How to store byte array to database with JDBC?
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. |
|
#3
| |||
| |||
| Re: How to store byte array to database with JDBC?
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. |
|
#4
| |||
| |||
| Re: How to store byte array to database with JDBC?
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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to store byte array to database with JDBC?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Store content of file in array of bytes | Aaliya Seth | Software Development | 5 | 21-01-2010 01:25 PM |
| File byte array to save in database | New ID | Software Development | 5 | 21-01-2010 11:22 AM |
| How to store space in a array in a C program | NetworkeR | Software Development | 3 | 03-11-2009 12:41 PM |
| Fill an array using a mysql database | Jacek | Software Development | 3 | 16-04-2009 01:12 AM |
| How JSP call JDBC database connection | Swetlano | Software Development | 3 | 28-02-2009 01:46 PM |