Monday, February 29, 2016

Re: [google-cloud-sql-discuss] problem with import image or picture file from bucket to sql cloud database

LOAD DATA LOCAL INFILE is not supported by our platform: https://cloud.google.com/sql/docs/introduction

My suggestion is that you probably don't really want images in your database anyway: it's more expensive in time to retrieve and more expensive when stored at rest. Instead, I would leave it where it is in GCS and just keep the link to it your database.

On Sat, Feb 27, 2016 at 11:19 AM <strategicpartners27@gmail.com> wrote:
 When I created the database table, I included only a field to store the photos using app scripts
and imported an photo file((jpg file) to a bucket.  However, I encountered a problem trying to
import the image file to a table.  The table field in the database is of the mediumblob data type.
The character set as defined in the sql import instruction is of utf8 type.  Is this a problem when
importing into database table?  The image file is not in a csv file.  Is it supposed to be included in a 
csv file?  If it is supposed to be included in a csv file,  how do I reference the image file in the csv file?
I was also trying to import image file using the app scripts function by using the following:


  var instanceUrl = 'jdbc:mysql://' + address;
  var dbUrl = instanceUrl + '/' + db;
  var conn = Jdbc.getConnection(dbUrl, user, userpwd);
  conn.createStatement().execute("UPDATE companylogo SET logo = LOAD DATA LOCAL INFILE(gs://imagedb/code_logo.png)");
// or using   conn.createStatement().execute("LOAD DATA LOCAL INFILE 'gs://imagedb/code_logo.png' INTO TABLE companylogo CHARACTER SET utf8");


Should I use a different character set like hex blob or varbinary? 
However,  I am getting a syntax error when trying to use either of the two statements.What is the correct syntax for the statements?
Oracle isn't too explanatory.  Are other methods of importing an image file to the database?


Thanks very much

Kevin






--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/10b4207c-bfd2-4e26-8b8f-733b8080fa76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CAAfRv6GfwWfNqOsZ5LXi9KOMMsQNXchW_du5LEyGLbtyEmWKWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment