User bio
 
EN
Specialized engineer in database management systems, I have participated in the development of applications for several software editors in the medical field or healthcare end-users, notably at the head office of the APHP.

To complete my expertise in data storage, I joined the editor Oracle, before joining InterSystems in 2001.

My skills in data processing have therefore been extended, from multi-model storage, interoperability (and more particularly on health exchange standards), to real-time analysis and artificial intelligence (AI / ML), so as to cover a broad spectrum of the data lifecycle in all industries.

 
FR
Ingénieur spécialisé en systèmes de gestion de bases de données, j'ai participé aux développements d'applications de plusieurs éditeurs du domaine médical ou d'établissements de santé, notamment au siège de l'APHP.

Pour compléter mon expertise en stockage de données, j'ai ensuite intégré l'éditeur Oracle, avant de rejoindre InterSystems France dès 2001.

Mes compétences en traitement de la donnée se sont dès lors étendues, depuis le stockage multi-modèles, l'interopérabilité (et plus particulièrement sur les standards d'échanges en santé), jusqu'à l'analyse en temps-réel et à l'intelligence artificielle (IA/ML), de manière à couvrir un large spectre du cycle de vie de la donnée.

 

Show all
Member since Dec 2, 2015
Replies:

Hi Zhang,

you'll find a JDBC example below : 

import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class RetrieveBlob {

  public static void main(String[] args) throws Exception {
    // Replace with your connection details
    String url = "jdbc:mysql://localhost:3306/your_database";
    String username = "your_username";
    String password = "your_password";

    Connection conn = DriverManager.getConnection(url, username, password);

    String sql = "SELECT image FROM your_table WHERE id = ?";
    PreparedStatement stmt = conn.prepareStatement(sql);
    stmt.setInt(1, 1); // Replace with the ID you want to query

    ResultSet rs = stmt.executeQuery();

    if (rs.next()) {
      Blob blob = rs.getBlob("image"); // Replace "image" with your column name

      // Option 1: Get Bytes
      byte[] imageBytes = blob.getBytes(1, (int) blob.length()); // Get all bytes
      // Process the imageBytes byte array

      // Option 2: Stream Processing
      // InputStream in = blob.getBinaryStream();
      // ... process the stream
    }

    rs.close();
    stmt.close();
    conn.close();
  }
}

Thanks @Alberto Fuentes 
I suggest to keep information regarding the classname of the message and its ID :

Method %ShowContents(pZenOutput As %Boolean = 0)
{
   do ..%JSONExportToString(.jsonExport)
    set formatter = ##class(%JSON.Formatter).%New()
    do formatter.FormatToString(jsonExport, .json)
    &html<
        <i style="color:green;">type: #($classname())#  id: #(..%Id())# </i>
        <pre>#(json)#</pre>
    >
}

 in order to get :

Open Exchange applications:
Certifications & Credly badges:
Global Masters badges:
Followers:
Following: