blob

com.mysql.jdbc.PacketTooBigException

三世轮回 提交于 2019-11-29 03:29:18
I am storing images in MYSQL. I have table as CREATE TABLE myTable (id INT, myImage BLOB); When I am trying to insert 4.7MB file, I am getting exception as com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4996552 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable. I believe this is related to image size only. Is there any other variable type that I can use? Update 1 As per older SO question, I also tried with MEDIUMBLOB but still I am getting same error. Adding Image to a database in Java Update 2 At the start of the project, I

Javascript - I created a blob from a string, how do I get the string back out?

南笙酒味 提交于 2019-11-29 02:49:06
I have a string that I called Blob() on: var mystring = "Hello World!"; var myblob = new Blob([mystring], { type: 'text/plain' }); mystring = ""; How do I get the string back out? function getBlobData(blob) { // Not sure what code to put here } alert(getBlobData(myblob)); // should alert "Hello World!" In order to extract data from a Blob, you need a FileReader . var reader = new FileReader(); reader.onload = function() { alert(reader.result); } reader.readAsText(blob); If the browser supports it, you could go via a blob URI and XMLHttpRequest it function blobToString(b) { var u, x; u = URL

Base64 representing PDF to blob - JavaScript

谁说我不能喝 提交于 2019-11-29 02:48:41
问题 I have a Base64 string representing a PDF file. I want to convert it to a file with the Blob object using javascript. After it's done i want to save the blob as a PDF file using FileSaver.js. Here is my code: var base64PDF = JVBERi0xLjQNCiW0t..; // This is a huge string. var blob = new Blob([base64PDF], { type: 'application/pdf' }); saveAs(blob, "test.pdf"); This code doesn't work. It saves a test.pdf that says it can't open this pdf because there was en error in the decoding. I've also tried

理解Git

柔情痞子 提交于 2019-11-29 02:39:21
理解Git ——《Git版本控制管理(第2版)》读书笔记一 Git特点或设计理念 有助于分布式开发 能够胜任上千开发人员的规模 性能优异(压缩技术、差异比较技术) 保持完整性和可靠性(安全散列函数) 强化责任(对所有改动可追踪) 不可变性 原子事务(Git通过记录完整、离散的版本库状态来实现原子事务。) 支持并且鼓励基于分支的开发(分支、合并) 完整的版本库(每个人的版本库中都有一份关于每个文件的完整的历史修订信息) 一个清晰的内部设计(对象模型) 免费自由 基本概念 git版本库 :一个简单的数据库,其中包含所有用来维护与管理项目的修订版本和历史的信息。 两个主要数据结构: 对象库 :Git版本库实现的心脏。包含你的原始数据文件、所有日志信息、日期等等。它包括4中对象类型: 块(blob):二进制大对象。文件的每一个版本表示为一个块。一个blob只保存一个文件的数据。 目录树(tree):一个tree对象代表一层目录信息。它记录blob标识符、路径名和一个目录里所有文件的一些元数据。可递归引用其他目录树或子树对象。 提交(commit):一个commit对象保存版本中每一次变化的元数据,包括作者、提交者、提交日期和日志消息。 标签(tag):一个tag对象分配一个任意的且人类可读的名字给一个特定对象。 索引 :一个临时的、动态的二进制文件,它描述整个版本库的目录结构

Insert binary file in SQLite database with Python

天涯浪子 提交于 2019-11-29 02:34:53
问题 I'm trying to write a simple Python script that inserts .odt documents into an SQLite database. Here is what I have done so far, but it doesn't seem to work: f=open('Loremipsum.odt', 'rb') k=f.read() f.close() cursor.execute="INSERT INTO notes (note) VALUES ('%s')" %(sqlite.Binary(k)) cursor.close() conn.close() I don't get any error messages, but as far as I can see the record is not inserted. What am I doing wrong? Also, how can I extract the stored document back? Thanks! 回答1: Not sure what

Stop Activerecord from loading Blob column

痴心易碎 提交于 2019-11-29 02:01:25
How can I tell Activerecord to not load blob columns unless explicitly asked for? There are some pretty large blobs in my legacy DB that must be excluded for 'normal' Objects. I just ran into this using rail 3. Fortunately it wasn't that difficult to solve. I set a default_scope that removed the particular columns I didn't want from the result. For example, in the model I had there was an xml text field that could be quite long that wasn't used in most views. default_scope select((column_names - ['data']).map { |column_name| "`#{table_name}`.`#{column_name}`"}) You'll see from the solution

Symfony2: How to display/download a BLOB field

£可爱£侵袭症+ 提交于 2019-11-29 01:28:57
For my client I have to use blob storage for some various files. So I have created a independent bundle with a Blob class extends Doctrine\DBAL\Types\Type. and with a boot function in the bundle class. That works pretty fine I can write in the database Blob datas. But I can't download any document after :/ I have got: public function downloadAction($id) { $em = $this->getDoctrine()->getManager(); /* @var $entity Document */ $entity = $em->getRepository('Lille3SapBundle:Document')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Document entity.'); } $file =

How can I extract files from an Oracle BLOB field?

拜拜、爱过 提交于 2019-11-28 23:42:14
I have a database which has a number of files stored in a BLOB field. How can I extract & save the original files? There are many different file types - doc, pdf, xls, etc. The table has the extension in one col, and the original file name in another. There may be multiple files with the same file name, too. You can use the UTL_FILE package to do this in version 9i onwards something like this: DECLARE l_file UTL_FILE.FILE_TYPE; l_buffer RAW(32767); l_amount BINARY_INTEGER := 32767; l_pos NUMBER := 1; l_blob BLOB; l_blob_len NUMBER; BEGIN SELECT blobcol INTO l_blob FROM table WHERE rownum = 1;

store TEXT/BLOB in same table or not?

一个人想着一个人 提交于 2019-11-28 23:26:26
While searching trough SO, I've found two contradicting answers (and even a comment that stated that) but no definitive answer: The problem is: is there any performance benefit, if you store a TEXT/BLOB field outside of a table? We assume: You SELECT correctly (only selection the TEXT/BLOB if required, no SELECT *) Tables are indexed properly, where it makes sense (so it's not a matter of 'if you index it') The database design doesnt really matter. This is a question to identify the MySQL behaviour in this special case, not to solve certain database design problems. Let's assume this Database

Database blobs vs Disk stored files

扶醉桌前 提交于 2019-11-28 23:24:09
问题 So I have this requirement that says the app must let users upload and download about 6000 files per month (mostly pdf, doc, xls). I was thinking about the optimal solution for this. Question is whether I'll use BLOb's in my database or a simple file hierarchy for writing/reading these bunch of files. The app architecture is based on Java 1.6, Spring 3.1 and DOJO, Informix 10.X. So I'm here just to be advised based on your experience. 回答1: If you have other data in database in relation to