title: Migrating MySQL blob (image) to FileMaker container using PowerShell
body: <p>In searching I've found a number of other people that have tried, but none that have been successful.</p>
  <p>Here's the problem. I want to take a bunch of images I have stored on my MySQL server in blobs and move them into FileMaker containers.</p>
  <p>The best lead I've got is the putas command. It looks something like putas ('$Image','JPEG').</p>
  <p>My particular application is as follows. $DataSet.Image1 is a JPEG file stored as &quot;0xFFD8....&quot;. The data being in this format may well be the issue, but I don't know what I'd need to convert it to first.</p>
  <pre><code>$cmd.CommandText = &quot;update Checklists set Image1 = PutAs('$($DataSet.Image1)', 'JPEG')&quot;
  $cmd.ExecuteNonQuery();
  </code></pre>
  <p>All I keep getting is syntax error, but I've tried the syntax many different ways I can't get it to go no matter what I do.</p>
  <p>I'd very much like to see someone having success with this to post their example. Any other ideas or workarounds are welcome as well.</p>
  <p>Edit:
  Here is some extra info. Greg Lane at Skeleton Key gives this example, but I'm not sure how to translate it to PowerShell.</p>
  <pre><code>import java.sql.*; import java.io.*;
  def url = &quot;jdbc:filemaker://localhost/fmserver_sample&quot;;
  def driver = &quot;com.filemaker.jdbc.Driver&quot;;
  def user = &quot;admin&quot;;
  def password = &quot;&quot;;
  System.setProperty(&quot;jdbc.drivers&quot;, driver);
  connection = DriverManager.getConnection (url, user, password);
  filename = &quot;/Users/Greg/Pictures/vacation/DSC_0202.jpg&quot;;
  file = new File (filename);
  inputstream = new FileInputStream (filename);
  sql = &quot;INSERT INTO english_nature (ID, img) VALUES (-1, PutAs(?, 'JPEG'))&quot;;
  pstatement = connection.prepareStatement ( sql );
  pstatement.setBinaryStream (1, inputstream, (int)file.length ());
  pstatement.execute ();
  //cleanup
  pstatement = null;
  inputstream = null;
  file = null;
  connection.close();
  </code></pre>