473,756 Members | 3,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error in inserting a long blob data

Hi
I am storing the attachment in the database. For some file the data
gets stored in the database but for other files it gives a MySql
error. For eg. when I am trying to attach the file foo.txtit gets
stored in database correctly whereas the file bar.txt gives an error.
The error given is:
Traceback (most recent call last):
File "fakeloginserve r.py", line 567, in _doRequest
_handleRequest( _wfile)
File "fakeloginserve r.py", line 812, in _handleRequest
response.body=_ theMethod(**(re quest.paramMap) )
File "fakeloginserve r.py", line 92, in invokeAddAttach ment
add.addAttachme nt(v,filename,v alues)
File "C:\Python23\Li b\site-packages\cherry py\code\Attachm ent_Model.py",
line 26, in addAttachment
n=cursor.execut e("insert into attachments
values('%s','%s ','%s','%s','%s ','%s','%s','%s ','%s')"
%(Attachment_Mo del.projectid[0],values['issueid'],attachID,datet ime,values['attachmentdesc ription'],contenttype,fi lename,values['attachmentpath '],submitterID))
File "C:\PYTHON23\Li b\site-packages\MySQLd b\cursors.py", line 95, in
execute
return self._execute(q uery, args)
File "C:\PYTHON23\Li b\site-packages\MySQLd b\cursors.py", line 114,
in _execute
self.errorhandl er(self, exc, value)
File "C:\PYTHON23\Li b\site-packages\MySQLd b\connections.p y", line
33, in defaulterrorhan dler
raise errorclass, errorvalue
ProgrammingErro r: (1064, "You have an error in your SQL syntax. Check
the manual that corresponds to your MySQL server version for the right
syntax to use near 're just getting started with CherryPy, read the
tutorial (in do")
values['attachmentpath '] contains the file data.
The data type of the file data is LONGBLOB in MySql.
I am not getting why it works for some file but not for others.
Jul 18 '05 #1
3 2003
>
values['attachmentpath '] contains the file data.
The data type of the file data is LONGBLOB in MySql.
I am not getting why it works for some file but not for others.


Do you have single quotes in your attachment - these would confuse the mysql
parser. I don't remember how to quote them for mysql (in oracle its '' for
a single quote) - but thats in the manuals.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2
"Diez B. Roggisch" <de************ @web.de> wrote in message news:<c1******* ******@news.t-online.com>...

values['attachmentpath '] contains the file data.
The data type of the file data is LONGBLOB in MySql.
I am not getting why it works for some file but not for others.


Do you have single quotes in your attachment - these would confuse the mysql
parser. I don't remember how to quote them for mysql (in oracle its '' for
a single quote) - but thats in the manuals.


How to escape such sequences in python
Jul 18 '05 #3
Diez,
From your error, you have a DB driver problem. MySql
says to use something like 'they''re' - double up the
inner '
ke***********@y ahoo.com wrote:
"Diez B. Roggisch" <de************ @web.de> wrote in message news:<c1******* ******@news.t-online.com>...
values['attachmentpath '] contains the file data.
The data type of the file data is LONGBLOB in MySql.
I am not getting why it works for some file but not for others.


Do you have single quotes in your attachment - these would confuse the mysql
parser. I don't remember how to quote them for mysql (in oracle its '' for
a single quote) - but thats in the manuals.

How to escape such sequences in python


Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5038
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
1
2794
by: M Bouloussa | last post by:
Hi, can you help me ? My problem is : I have two tablespaces (sdata0 and sdata1) On the first tablespace (sdata0) I would to store all the data except long raw data and on the second tablespace (sdata1) I would to store the long raw data This code works fine
0
1468
by: Bing | last post by:
Hi there, I am using the DB2 universal JDBC driver type 4 to insert BLOBs into a DB2 database. The Method I used for supplying the BLOB data value is setBinaryStream(). Everything works fine as long as the binary data is less than or equal to 100k. Anything larger than that (even for one byte) will result an exception saying the value is too large. All the DB2 samples (at least two)I have found have a limit of 100k (magic number!!!),...
1
6530
by: sid_mulpuru | last post by:
I am trying to read data from a DB2 Blob Data type Field (using wsad 5.1.0) using getBlob() which when executed gives an SQL Exception 2005-01-07 15:48:40,506 ERROR - Error in servlet:xxxxx.jsp initiateDownloadFri Jan 07 15:48:39 CST 2005com.ibm.db2.jcc.a.SqlException: 1 (in debug mode exception called at rs =
4
2383
by: mghale | last post by:
My client's application is generating an exception of CLI0112 and SQLSTATE 22005 when accessing a BLOB column. The condition resolves itself when I recycle DB2, access if fine for a while, and then the exception happens again. The developers seem to believe it is occurring when two clients are requesting the same BLOB record at the same time. I do not believe this to be true and wanted some back up. Their opinion is that DB2 can only...
2
9476
by: Charles Wilt | last post by:
I have a IBM iSeries (aka AS-400) running v5r3 of OS/400 that I access via a linked server from SQL Server 2000. The following select works fine: select * from prod400db.test.meldbf.InventoryHistory However, this insert statement fails: insert into prod400db.TEST.MELDBF.InventoryHistory
0
1664
by: Harshadcode | last post by:
Hi, This is HARSHAD, I am creating a project in VB.NET for managing details like photos of criminals. but i am facing problems in converting a image in to filestream so that it can be inserted in to the oracle 10g database using BLOB variable type. if you can help me it will be very helpful.. This is my code: --------------------------------------------------------------------- Imports System
1
366
by: Bhavesh | last post by:
Hi Bruce, Thanks For Reply. U were right, Needed to pass string , but also need to pass size of Data( instead of 16, passed actual length of data). So that worked for me & didn't get any error. But now problem in fetching, not able to fetch data from table correctly. Here is my code. I hav following problems with this coding
16
6670
by: wizard | last post by:
Here is a piece of code below for writing and reading blobs in SQLITE database. I ' ve a problem to read from blob struct called 'Points' Any help would be appreciated Reagards Greg #include <stdlib.h> #include <stdio.h>
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10046
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.