blob

Rails rename_column migration issue

Hi there, I am trying to run a migration on an existing database to change the column name on a table. When I run the migration, I get an error stating that Blob/Text fields cannot have a default value. The column in question is a text column, with a non-null attribute, but no default value. The migration that Rails attempts is: ALTE...

Reading an image from the database using C#?

I've got this query: SELECT PICTURE FROM LOGO WHERE LOGONO = ? ("PICTURE" is an Image column in SQL Server) And this code to read the data: using (DbDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { if (!reader.IsDBNull(0)) { byte[] buffer = new byte[8000]; while (re...

store a pdf in mysql

How would you store a PDF document in a field in mysql? Currently I have a list of customers and each customer has a certificate with information about their account that they can give to other companies to prove that they're our customer. Currently their certificate is exported as a pdf and e-mailed to someone here at work (the custome...

How can I load an image file into a blob in SQLite using Perl?

Could someone please give me a Perl example on how to load an image file into a blob in SQLite? ...

How can I identify a file type from a blob/filestream?

We bought an "off the shelf" application a lonnng time ago that is capable of storing files as a blob within SQL Server. We've noticed that the database has more than doubled in size within the past six months due to more frequent usage of this blob field by one department. As a result, the application has become painfully slow. I'v...

Help me understand the difference between CLOBs and BLOBs in Oracle

This is mainly just a "check my understanding" type of question. Here's my understanding of CLOBs and BLOBs as they work in Oracle: CLOBs are for text like XML, JSON, etc. You should not assume what encoding the database will store it as (at least in an application) as it will be converted to whatever encoding the database was config...

What is the difference between converting to hex on the client end and using rawtohex?

I have a table that's created like this: CREATE TABLE bin_test (id INTEGER PRIMARY KEY, b BLOB) Using Python and cx_Oracle, if I do this: value = "\xff\x00\xff\x00" #The string represented in hex by ff00ff00 self.connection.execute("INSERT INTO bin_test (b) VALUES (rawtohex(?))", (value,)) self.connection.exec...

Reading Google Gears blobs with JavaScript

Does anybody know how to read google gears blob objects within the browser? I'm using gwt on top of gears, but I'm looking for any kind of solutions. The application needs to work fully offline so I can't post the files and process them server side. My files are simple text files that I want to upload and parse in offline mode. ...

correct way to upload image to database

i know some of you are going to say that this isnt the correct way but im on a tight deadline to finish an application and as of now i cant go back and modify the code to store the images in a directory. now that thats cleared the question i had is i inserted an image into the database by typing this. (dont mind the class security ca...

how to read my blob column from mysql to string type in hibernate

how to read my blob column from mysql to string type in hibernate I have try this way but alway return me: [B@196f4b5 Article article2=f.daoArticle.findById(article.getSrcUrl()); String vbody = article2.getArticle(); System.out.println(vbody); \\hbm <class catalog="ariso" name="countaword.ariso.dao.Article" table="a...

Storing Array of Floats as a BLOB in Oracle

I am designing a new laboratory database. For some tests, I have several waveforms with ~10,000 data points acquired simultaneously. In the application (written in C), the waveforms are stored as an array of floats. I believe I would like to store each waveform as a BLOB. Questions: Can the data in a BLOB be structured in such a w...

Storing images on a database

For ages I've been told not to store images on the database, or any big BLOB for that matter. While I can understand why the databases aren't/weren't efficient for that I never understood why they couldn't. If I can put a file somewhere and reference it, why couldn't the database engine do the same. I'm glad Damien Katz mentioned it on a...

Informix 7.3 isql insert statement - text/blob/clob field insert error

Is a way around this?? I am trying to insert some data into a table whose structure is: Column name Type Nulls crs_no char(12) no cat char(4) no pr_cat char(1) ...

Snippet to create a file from the contents of a blob in Java

I have some files stored in a database blob column in Oracle 9. I would like to have those files stored in the file system. This should be pretty easy, but I don't find the right snipped. How can I do this in java? PreparedStatement ptmst = ... ResutlSet rs = pstmt.executeQuer(); rs.getBlob(); // mistery FileOutputStream out...

MySQL 5.0: Output BLOB data in (well-formed) XML format?

I'm writing a web interface to MySQL that executes a couple queries and returns some XML data with the results of the queries. Right now, the table the query is running on has three LONGBLOB columns (for storing image data and the like). However, when I try to parse the XML, I run into trouble with certain characters in the BLOB columns...

What's wrong with adding LOBs to an Oracle table?

I'm trying to ALTER a table by adding a new CLOB column (on Oracle 10), but it's failing. Giving me an ORA-01735 error. Problem is I can't find out what in particular is wrong with my query by googling around so I figured I'd ask here just in case. Anyways my query is: ALTER TABLE "MYSCHEMA"."MYTABLE" ADD "ACOLUMN" CLOB(2048); And g...

storing binary data in mysql

I have a PDF file on a local machine. I want to upload this file into a BINARY BLOB on a SQL database. Other approaches mentioned here [http://stackoverflow.com/questions/17/binary-data-in-mysql] all use PHP. I want a simple clean way to upload this PDF file on the Linux command line. Unfortunately, I do not have access to the remote fil...

How to set binary data using setBlob() in C++ connector

I know this has been asked before, and I tried to implement the solution, but I just get exception errors when I call ps->executeUpdate(). Has anyone got an explicit example? ...

What's the best way to send pictures to a browser when they have to be stored as blobs in a database?

I have an existing database containing some pictures in blob fields. For a web application I have to display them. What's the best way to do that, considering stress on the server and maintenance and coding efforts. I can think of the following: "Cache" the blobs to external files and send the files to the browser. Read them from di...

How do I write an uploaded file to disk using the Oracle directory alias and BFILE objects?

I have a java webapp which needs to upload files via http and then store them on the server. The files need to be associated with specific records in an Oracle database, so there will be a table in the database storing the reference to the associated record, and a reference to the file, along with other descriptive data such as title etc...