as per my requirement i want to store image in blob format in db Cassandara in a column type blob.
table: image_store
---------
image_id<int>|image_blob<blob>
I have google image in my filesystem. This will be a utility class which will be just used to convert image in blob.
Can I print blob value in text file or console sysout?
Is there any online website as well which can convert my file to blob and provide in text format so that i can just update in table.
Thanks in advance
Related
I have a requirement to insert blob value into one of the tables(DB type - Oracle). I am using Java to convert my image file into a byte array first and then to blob object by using javax.sql.rowset.serial.SerialBlob.
However, when I create a blob object using
Blob blob = new SerialBlob(byteArray);
The resulting blob object is of the form javax.sql.rowset.serial.SerialBlob#'some-hex-value'. When I use the blob object in my insert query, Oracle gives me: Invalid hex number error.
But when I try to insert using only the hex part and removing 'javax.sql.rowset.serial.SerialBlob' part from my blob object, the insert query works fine and the record gets inserted.
So is there any way to extract the hex value from the blob object that I am converting my image file into?
Thanks!
I want to create a separate notes file for each user.
The notes files are kept in a network file system(or the server).
Suppose I have a table employee_info
empid empname pathtofile
50 John \\[filepathfromnetworkfilesystem]\50.txt
51 Max \\[filepathfromnNFS]\51.txt
Which datatype will the 'pathtofile' column be?
I checked BLOB and CLOB, but they store binary, so not sure those are appropriate datatypes here.
And any sample code, how can I access this column from java code to retrieve the contents of the file?
Any help would be appreciated.
I have a requirement to read the value form a PDF file and save the result in a db.
I have converted Pdf to text .
Now the text data looks like this:
Test Name Results Units Bio. Ref. Interval
LIPID PROFILE, BASIC, SERUM
Cholesterol Total 166.00 mg/dL <200.00
Triglycerides 118.00 mg/dL <150.00
My requirement is to read the table data from the Pdf file and save in the MySQL database as it is.
use java io to read the text file and jdbc to safe the information in the mysql via sql.
I have an sql server database table which has xml column name called "Bodytext" which will store xml data.
Now I need to get this "Bodytext" column data and save into System physical path as xml file(Ex: test.xml etc.,)
Any suggestion how to implement this using JAVA?
The column type would be BLOB or CLOB. Retrieve the column data and write the byte data to your file and make it abc.xml
I have a 2 tables, CONFIGURATION_INFO and CONFIGURATION_FILE. I use the below query to find out all employee files
select i.cfg_id, Filecontent
from CONFIGURATION_INFO i,
CONFIGURATION_FILE f
where i.cfg_id=f.cfg_id
but I also need to parse or extract data from the blob column Filecontent and display all cfg_id whose xml tag PCVERSION starts with 8. Is there any way?
XML tag that needs to be extracted is <CSMCLIENT><COMPONENT><PCVERSION>8.1</PCVERSION></COMPONENT></CSMCLIENT>
XML
It need not be any query, even if it is a java or groovy code, it would help me.
Note: Some of the XMLs might be as big as 5MB.
So basically the data from the table CONFIGURATION_INFO, for the column Filecontent is BLOB?
So the syntax to query out the XML from the BLOB Content from database is using this function XMLType.
This function is converting the datatype of your column from BLOB to XMLType. Then parsing it using XPath function.
Oracle Database
select
xmltype(Filecontent, 871).extract('//CSMCLIENT/COMPONENT/PCVERSION/text()').getstringval()
from CONFIGURATION_INFO ...
do the rest of WHERE logic on your own.
Usally you know what the data in the BLOB column, so you can parse in the SQL query..
If it is a text column (varchar or something like that) you can use to_char(coloumName).
There are a lot of functions that you can use you can find them in this link
Usually you will use to_char/to_date/hexToRow/rowTohex
convert blob to file link