java - Need help- Query to insert an image into a table in sql developer3.0 -


Hello I am using SQL Developer 3.0.

I need to store images in the form of a blob in the table.

I have created a table as:

  Create account tables (IMG_ID number, MP_ID number, icon blob);   

I need to store images

  'C: \ project \ images \'   

any Also please help me insert images in database wuth SQL queries ??

Thanks in advance.

  1. Store your image to a file.

    file image = new file ("'c: \ project \ images \ image.jpg");

  2. The SQL query to insert.

    Enter the string Sql = "account_image (IMG_ID, IMG_ID, Icon) value (1,1,?)";

  3. Paper Statement >

  4. Write a file in the file

    FileInputStream fis = Fis = new FileInputStream (image)> ;

  5. Attach the fissure to the prepared

    pStatement.setBinaryStream (1, fis, fis.length ());

  6. Execute

    Result as a result = pStatement.executeUpdate ();

    A complete

      file image = new file ("'c: \ project \ images \ image.jpg"); String Sql = "Enter into account_mage (img_id, img_id, icon) value (1,1,?)"; Created condition pStatement = connection.prepareStatement (SQL); FileInputStream fis = fis = New FileInputStream (Image); PStatement.setBinaryStream (1, fis, fis.length ()); Results Result = pStatement.executeUpdate ();    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -