Re: [PHP-DB] Blob problem (php and oracle)
Here are some things you could try. Remove all the "@" suppressions and make sure error_reporting = E_ALL and display_errors = On are set in your php.ini. Echo the SQL statement inside SQLInsertLob() to make sure it is constructed OK. Echo the filename to check it includes the appropriate path. If there is no path, try using the absolute path e.g. /tmp/myfile.xml Check $this->ConnectionID is ok and you can do a simple query in SQLInsertLob(). Change &$lob to $lob (this fixes a different problem). Chris EL Marouri Mounir wrote: hi all, i have a problem in saving a blob file into oracle database the system is linux 7.3 oracle 9i apache and php things are working pretty well in other machine (same php source code) but in my machine it gives this error savefile():OCILobWrite : OCI_INVALID_HANDLE. this is the php: $oci->SQLInsertLob(3, "insert into FICHIER_BDS(FICH_BDS_ID, FICH_BDS_NOM, BDS_ID, FICH_BDS_SOURCE, FICH_BDS_XML, FICH_BDS_SIZE, FICH_BDS_TYPE, VER_ID) values (FICH_BDS_ID.nextval, '" .$file_name. "', $BDS_ID,'0',EMPTY_BLOB(), $file_size, '" .$file_type. "', '" .$VER_ID. "') returning FICH_BDS_XML into :the_blob",$file); } the oci function : function SQLInsertLob($num, $req, $lob_upload) { if ($num < 0 || $num > $this->NumReq) { $this->err = "Numéro de statement incorrect"; return false; } $lob = @OCINewDescriptor($this->ConnectionID, OCI_D_LOB); $this->Result[$num] = @OCIParse($this->ConnectionID, $req); @OCIBindByName($this->Result[$num], ':the_blob', &$lob, -1, OCI_B_BLOB); @OCIExecute($this->Result[$num], OCI_DEFAULT); if($lob->savefile($lob_upload)) { return true; }else{ return false; } $lob->free(); @OCIFreeStatement($this->Result[$num]); } le file is temporary located in /tmp/ apache is runing with apache user when the file is created the permissions is rw--r--r--i have tried with file 777 to make sure but i still have the same error and then i have tried to execute the sql statement in sqlplus with '0' as blob the sql is OK in other page it can load blob file from oracle database i really don't see where is the problem if someone have any idea thanks to all __ Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
$data = mysql_query("select from "); while ($d = mysql_fetch_array($data)) { echo $d[''].""; } .. or something like that. -Micah On Tuesday 16 March 2004 05:16 pm, Ng Hwee Hwee wrote: > hi, > > i've read the blob document in MySQL manual and i know it is similar to a > text field and can store large amount of binary data..however, in > phpMyAdmin 2.5.4, i can't see the contents of my blob fields... how do you > view it? > > sorry for my ignorance.. > > hwee > > - Original Message - > From: "JeRRy" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, March 16, 2004 1:27 PM > Subject: Re: [PHP-DB] BLOB > > > Whoa, watch what your saying here because your well > > off the ball here. For everyone else who is not aware > > BLOB is zilch security. The details in a BLOB field > > is viewable easy enough. Please read about BLOB on > > the mysql website that I listed to you, read it very > > carefully, obviously you did not even read a line of > > it. Because the first few paragraphs tells you what > > it is, similar to a text field if you read it. Please > > read links people send to you, otherwise why should we > > bother wasting our time replying if you can't take the > > courtesy to read what we type? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
hi, i've read the blob document in MySQL manual and i know it is similar to a text field and can store large amount of binary data..however, in phpMyAdmin 2.5.4, i can't see the contents of my blob fields... how do you view it? sorry for my ignorance.. hwee - Original Message - From: "JeRRy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 16, 2004 1:27 PM Subject: Re: [PHP-DB] BLOB > > Whoa, watch what your saying here because your well > off the ball here. For everyone else who is not aware > BLOB is zilch security. The details in a BLOB field > is viewable easy enough. Please read about BLOB on > the mysql website that I listed to you, read it very > carefully, obviously you did not even read a line of > it. Because the first few paragraphs tells you what > it is, similar to a text field if you read it. Please > read links people send to you, otherwise why should we > bother wasting our time replying if you can't take the > courtesy to read what we type? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Date: Mon, 15 Mar 2004 17:24:31 +0800 Subject: Re: [PHP-DB] BLOB hi all, Hi ;) with blob, i can't see the encoded password easily and thus there is 'maximum security'. haha.. but i'm still open to any form of suggestions! Whoa, watch what your saying here because your well off the ball here. For everyone else who is not aware BLOB is zilch security. The details in a BLOB field is viewable easy enough. Please read about BLOB on the mysql website that I listed to you, read it very carefully, obviously you did not even read a line of it. Because the first few paragraphs tells you what it is, similar to a text field if you read it. Please read links people send to you, otherwise why should we bother wasting our time replying if you can't take the courtesy to read what we type? I can understand your a newbie, but don't try and think you know 100% BLOB is secure, coz you have a big fat X mark against that and you have failed the test. Also your sending miss-leading info to other inoccent people, but for the record BLOB is not secure as for protecting it's content. Anyways for password usage your better off using md5, if they lose the password get the system to generate and set a new one, email it to the user and get them to login and change it. Another way around it is a secret question they must answer, if correct they can reset their password on the fly. But I can see those two might not be easy for you. Well both to be honest is not simple for a newbie, but if you need assistance please post to the board, I am happy to assist if I can and so are others. Noone will post you a full working script on here unless they are feeling very generous, but sniplets they will for sure uncluding I. But if you need a website created you better off paying $50 or so and get it done professionally if you want your site secure. Choose a reliable source though, be careful is the key and do some homework. :) I run a web hosting business (off topic a bit I know) so if you need help just shoot. :) thanx! No worries, goodluck! J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
On Monday 15 March 2004 17:24, Ng Hwee Hwee wrote: Use md5. > I can't use md5 because i want to retrieve it and send emails to my users > if they forgot their password.. If they forget their password shoot them. Or depending on how secure your application needs to be: - generate a new password, send it to the user and ask them to login using new password then change it - send them an email containing a token (you need to generate a token and insert into database), give them a page where they can enter that token and allow them to change password. Refer to the archives for details and maybe other methods for dealing with lost passwords. > md5 is only a one way encryption, It is not an encryption, it's a one-way hash. > thus i have to resort to using > encode('$password', '$salt') where $salt is a value that i have assigned.. > > because I know the value of $salt, I would be able to decode the password > easily by looking at my database and running decode. If your database and webserver are both located on the same server then encoding (or encrypting) anything is largely a waste of effort. If a hostile user ever gets access to your database they would (most likely) will have access to your decryption key as well - in this case your salt. Encryption is only useful where the data and the means of decrypting it are stored in separate locations and compromise of one does not neccessarily lead to the compromise of the other. > with blob, i can't see the encoded password easily and thus there is > 'maximum security'. haha.. but i'm still open to any form of suggestions! So pretending that you cannot 'see' the password increases the security!?! Like the myth about ostriches burying their heads in the sand to 'hide' from their enemies? If you don't want to accidently see people's passwords why not just rot13 it (apparently some companies seems to think that is a secure enough form of encryption). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Steckel's Rule to Success: Good enough is never good enough. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
hi all, I can't use md5 because i want to retrieve it and send emails to my users if they forgot their password.. md5 is only a one way encryption, thus i have to resort to using encode('$password', '$salt') where $salt is a value that i have assigned.. because I know the value of $salt, I would be able to decode the password easily by looking at my database and running decode. with blob, i can't see the encoded password easily and thus there is 'maximum security'. haha.. but i'm still open to any form of suggestions! thanx! - Original Message - From: "Marcjon Louwersheimer" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> Sent: Monday, March 15, 2004 4:38 PM Subject: Re: [PHP-DB] BLOB > Store the passwords using the md5() function. When inserting the password > into the database, use md5($password). It will convert the password to a > encrypted form using one way encryption. When you compare a entered > password to a password stored in the database, make the password entered > by the user md5($enteredpassword) and compare it to the raw password from > the database. Hope that helps! > -- > Marcjon > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
Hello, A BLOB is a binary large object that can hold a variable amount of data. The four BLOB types TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB differ only in the maximum length of the values they can hold. The four TEXT types TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT correspond to the four BLOB types and have the same maximum lengths and storage requirements. The only difference between BLOB and TEXT types is that sorting and comparison is performed in case-sensitive fashion for BLOB values and case-insensitive fashion for TEXT values. In other words, a TEXT is a case-insensitive BLOB. No case conversion takes place during storage or retrieval. If you assign a value to a BLOB or TEXT column that exceeds the column type's maximum length, the value is truncated to fit. Please read details at the address below: http://www.mysql.com/doc/en/BLOB.html Regarding hiding password from people accessing the database take a look at these: http://www.mysql.com/doc/en/Encryption_functions.html http://www.mysql.com/documentation/connector-j/index.html http://au.php.net/manual/en/function.md5.php Unoffical sites: http://www.allhype.co.uk/freestuff/scripts/php/md5/ http://www.teencoderz.com/article.php?story=20030808200312747 http://halfos.street-tv.net/lib/php/function.md5.php.htm I hope this helps. Any questions please reply to the board. :) ([EMAIL PROTECTED]) Jerry From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "PHP DB" <[EMAIL PROTECTED]> Date: Mon, 15 Mar 2004 09:18:50 +0800 Subject: Re: [PHP-DB] BLOB hi all.. thank you so much for your help! i tried out the all the different syntax and the following works perfectly SELECT * FROM `MEMBER` WHERE `PASSWD` = "" thanx, amanda! btw, i was trying to store the encryted password in the database but i do not want anyone who has the right to see the database (even myself!) to be able to know the password, so that there is maximum 'security'. That's why i used the blob field for my password.. hmmm... is this the right way of doing things? hwee Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
Why would blob be any more secure than anything else? If encryption isn't enough, you're not using the right encryption. :) -Micah On Sunday 14 March 2004 05:18 pm, Ng Hwee Hwee wrote: > hi all.. > > thank you so much for your help! > > i tried out the all the different syntax and the following works perfectly > > SELECT * FROM `MEMBER` WHERE `PASSWD` = "" > > thanx, amanda! > > btw, i was trying to store the encryted password in the database but i do > not want anyone who has the right to see the database (even myself!) to be > able to know the password, so that there is maximum 'security'. That's why > i used the blob field for my password.. hmmm... is this the right way of > doing things? > > hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
hi all.. thank you so much for your help! i tried out the all the different syntax and the following works perfectly SELECT * FROM `MEMBER` WHERE `PASSWD` = "" thanx, amanda! btw, i was trying to store the encryted password in the database but i do not want anyone who has the right to see the database (even myself!) to be able to know the password, so that there is maximum 'security'. That's why i used the blob field for my password.. hmmm... is this the right way of doing things? hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
i think this is the right sintax: SELECT * FROM `MEMBER` WHERE ISNULL(`PASSWD`) Passwd is a blob, that is an interesting name for a blob field, what are you planing to do? - Original Message - From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Sent: Friday, March 12, 2004 4:39 AM Subject: [PHP-DB] BLOB Hi all, how do i find out if a BLOB field in my table is NULL? i tried: SELECT * FROM `MEMBER` WHERE `PASSWD` is NULL however, although there is one entry in my table that has nothing in my PASSWD field, the result set is empty.. how come? how do i search for entries that has password = [BLOB - 0 bytes] ?? thanx so much!! huihui -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB
Thxalot! I didn't thought it would be that easy *g* - matthias st. John W. Holmes <[EMAIL PROTECTED]> [EMAIL PROTECTED] 14:12 Uhr: >> Does anybody know a good reference, where I can lern how to insert > binary >> data (e.g. Images) into a BLOB-Field of a MySQL-Database? > > Use fopen() to open the image, fread() it into a variable, and insert > that variable like you would any other one. If the image is coming from > an element, then you already have the image data > present in the $_FILES array that you can insert. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] BLOB
> Does anybody know a good reference, where I can lern how to insert binary > data (e.g. Images) into a BLOB-Field of a MySQL-Database? Use fopen() to open the image, fread() it into a variable, and insert that variable like you would any other one. If the image is coming from an element, then you already have the image data present in the $_FILES array that you can insert. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob
> I want to be able to load PDFs into mysql DB, but I'm not very familiar with > the blob data type? > Can someone point me on the right direction how to do this? Use fopen() in binary mode and fread() to read the file into a string, then insert it into the database as you would any other variable in any other column. Make sure you have a large enough BLOB to support your file sizes. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob
Keep in mind that BLOB is up to 64k thus you may need larger BLOB. Look at the mysql's documenations for more information http://www.mysql.com/doc/en/ Andrey P.S. Have a nice night. - Original Message - From: "Natividad Castro" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 07, 2003 10:17 PM Subject: [PHP-DB] blob > Hi to all, > I want to be able to load PDFs into mysql DB, but I'm not very familiar with > the blob data type? > Can someone point me on the right direction how to do this? > > Thanks in advance > Nato > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB retrieval
Go to www.php.net and type in the name of your database (mysql, postgres, oracle, mssql) in the search box. That will give you a list of all the functions available. Getting a blob is generally the same as getting any other data type. Here's the paradigm: 1. connect to the database 2. execute SQL statement 3. parse/display results WIth MySQL, this is done with the following functions: // 1. connect to the database mysql_connect( , , ); mysql_select_db( ); // 2. execute SQL statement $result = mysql_query( ); // 3. parse/display results $array = mysql_fetch_array( ); Here are a couple pretty decent tutorials on using PHP and MySQL that will probably get you started: http://uug.clubs.byu.edu/articles.php?show_article=11 and http://uug.clubs.byu.edu/articles.php?show_article=53 But, of course, PHP.net is the ultimate source of excellent documentation on php. You should rarely need to go anywhere else (including google) to get most php info. Good luck. Let us know how it goes! --Dave chekmate (remove) wrote: >Hi everyone, >I am new to php. >I have searched the net trying to find a basic code snippet that will >demonstrate how to download BLOB's from a database. I am not looking for a >solution exactly, but rather a good starting point. I want to learn this on >my own. Maybe with a little help. :) >Is there a resource you could point me to? Or could someone post a small >sample of code that will get me started? >Thanks in advance, > > >Tim Eberly > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob versus file
On Tue, 02 Jul 2002 12:57:56 +0200 Michael Bretterklieber <[EMAIL PROTECTED]> wrote: > Hi, > > one point that you should keeped in mind is, if you have a cluster of > webservers connecting to the same db-server, then you have to mount the > filesystems, where you store the images on all webservers. For multi-server images/docs server, we usually create a virtual host (images.domain.net), and avoid counter productive nfs or network filesystem. Generally, the method you choose depends of the portability level, maintenance, recovery system, ... Just test & valident the different methods provided in this thread, you find the one fit to your needs. hth pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob versus file
Hi, one point that you should keeped in mind is, if you have a cluster of webservers connecting to the same db-server, then you have to mount the filesystems, where you store the images on all webservers. On the other hand many db's like oracle have many restrictions with lobs. In oracle you can have only one LOB per table. And also functions like SELECT DISTINCT or GROUP BY are not supported on LOB-fields. MySQL is here the positive exception, because MySQL supports such functions also on LOB-fields. We store images and other documents on the filesystem, but text-data like session-data ist stored in LOB's, bye, Pierre-Alain Joye schrieb: > On Tue, 2 Jul 2002 05:45:40 +0200 > "Andy" <[EMAIL PROTECTED]> wrote: > > >>is the increase of the network traffic noticable? The query is pretty small >>just text. Do u really think this might increase the traffic? > > Try to heavely charge a DB with images inside it. > Do the same without DB, that depends if the dbms is in another server or not, note >localhost server can use the network interface and not the socket. > > then compare the two methods, and use the best :). > > Tests are always the best way to get the best methods :). > > > >>I also noticed that the image is not cached anymore. Is this true for all >>blobs, or do I just access them in a wron way? > > Cached ? Client side ? > > > hth > > pa > -- -- Michael Bretterklieber LCP JAWA Management Software GmbH Liebenauer Hauptstr. 200 A-8041 GRAZ Tel: ++43-(0)316-403274-12 Fax: ++43-(0)316-403274-10 GSM: ++43-(0)676-93 96 698 [EMAIL PROTECTED] homepage: http://www.jawa.at - privat --- E-mail: [EMAIL PROTECTED] homepage: http://www.inode.at/mbretter -- "...the number of UNIX installations has grown to 10, with more expected..." - Dennis Ritchie and Ken Thompson, June 1972 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob versus file
On Tue, 2 Jul 2002 05:45:40 +0200 "Andy" <[EMAIL PROTECTED]> wrote: > is the increase of the network traffic noticable? The query is pretty small > just text. Do u really think this might increase the traffic? Try to heavely charge a DB with images inside it. Do the same without DB, that depends if the dbms is in another server or not, note localhost server can use the network interface and not the socket. then compare the two methods, and use the best :). Tests are always the best way to get the best methods :). > I also noticed that the image is not cached anymore. Is this true for all > blobs, or do I just access them in a wron way? Cached ? Client side ? hth pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob versus file
is the increase of the network traffic noticable? The query is pretty small just text. Do u really think this might increase the traffic? I also noticed that the image is not cached anymore. Is this true for all blobs, or do I just access them in a wron way? (I am requesting a php file in the schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 1 Jul 2002 14:17:53 +0200 > "andy" <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > > I am wondering if anybody has experiance in saving images to blob in mysql. > > > > I do save images with 1 K and 4 KB to blob fields while I used to save them > > to file. It seams to me that this is much slower accessing the files. The > > images take a bit (really short but absolutly noticable) to show up on the > > site. Is there a way to improve the performance, and why is this happening? > > I thought the performance might even boost after storing them to blobs. > > Not really, the OS filesystem contains features that makes it always faster than a sql query, that will increase your network traffic too. > > Inserting images or whatever binary data in a database does not have much sense, you could not do a query with this field, cannot be indexed (dunno if exists a DB that implement a image indexer ;) ). Storing relative pathes gave me always more portabilities between DBM. > > In some case, you have to insert images (or every others binary data) in DB (due to global permissions system only avaible for the DB and not for the filesystem, for example), but as far is possible, I avoid to do it so. > > IMHO :) > > pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] blob versus file
On Mon, 1 Jul 2002 14:17:53 +0200 "andy" <[EMAIL PROTECTED]> wrote: > Hi there, > > I am wondering if anybody has experiance in saving images to blob in mysql. > > I do save images with 1 K and 4 KB to blob fields while I used to save them > to file. It seams to me that this is much slower accessing the files. The > images take a bit (really short but absolutly noticable) to show up on the > site. Is there a way to improve the performance, and why is this happening? > I thought the performance might even boost after storing them to blobs. Not really, the OS filesystem contains features that makes it always faster than a sql query, that will increase your network traffic too. Inserting images or whatever binary data in a database does not have much sense, you could not do a query with this field, cannot be indexed (dunno if exists a DB that implement a image indexer ;) ). Storing relative pathes gave me always more portabilities between DBM. In some case, you have to insert images (or every others binary data) in DB (due to global permissions system only avaible for the DB and not for the filesystem, for example), but as far is possible, I avoid to do it so. IMHO :) pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php