problem with import image or picture file from bucket to sql cloud database

86 views
Skip to first unread message

strategic...@gmail.com

unread,
Feb 27, 2016, 2:19:44 PM2/27/16
to Google Cloud SQL discuss
 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






Chris Lewis

unread,
Feb 29, 2016, 12:45:04 PM2/29/16
to Google Cloud SQL discuss
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.

--
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-d...@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.

Kevin August

unread,
Feb 29, 2016, 1:25:12 PM2/29/16
to google-cloud...@googlegroups.com
Hi Chris

Thanks for the suggestions.  I have the images stored in the driveapp.  
Do you suggest any other places within google to store the images?

Thanks

Kevin


--
You received this message because you are subscribed to a topic in the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-cloud-sql-discuss/ksAOJMQBnt4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-cloud-sql-d...@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.

Chris Lewis

unread,
Mar 1, 2016, 12:09:53 PM3/1/16
to google-cloud...@googlegroups.com
Google Cloud Storage would be the best place; both in terms of speed of retrieval and cost to host.

Kevin August

unread,
Mar 15, 2016, 10:59:24 PM3/15/16
to google-cloud...@googlegroups.com
Hi Chris Lewis

I have a question regarding passing variables between functions in
Google App Scripts.  I have been looking online for days.  May 
you help me with the issue?  I'm getting an undefined variable error.ng




function doGet(formvar)  {
fx = thefunction():

do something
}

function thefunction(object) {
   var formvar = object.type:
  return formvar
}

Appreciate all your help.  If you don't know the answer,  may you give a contact person
in the app script department?  Thanks 

Have a nice day, Chris

Kevin 


  



Reply all
Reply to author
Forward
0 new messages