Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3722270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:50:35+00:00 2026-05-19T05:50:35+00:00

I am trying to save an Image to Derby Db(JDBC),but it gives exception void

  • 0

I am trying to save an Image to Derby Db(JDBC),but it gives exception

   void imageload () {
FileDialog fd = new FileDialog(MainFram.this,"Open", FileDialog.LOAD);
fd.show();
if(fd.getFile() == null){
//Label1.setText("You have not chosen any image files yet");
}
else{

String d = (fd.getDirectory() + fd.getFile());
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image1 = toolkit.getImage(d);`
Object saveImage=Image1;
insertImage(saveImage) //Db function

`
Here is my DB function

public void insertImage(String CUST_ID, Object saveImage) throws SQLException {
    try {
            Class.forName(driver);
            con = DriverManager.getConnection(connectionURL);

            } catch (SQLException ex) {
            Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ClassNotFoundException ex) {
            Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex);
            }      
     FileInputStream fis = new FileInputStream(saveImage);
    stm = con.prepareStatement("insert into customer (PHOTO ) values(?)); //it gives errorr here
    stm.setObject(5,saveImage);

    stm.executeUpdate();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:50:37+00:00Added an answer on May 19, 2026 at 5:50 am
    void imageload () {
    FileDialog fd = new FileDialog(MainFram.this,"Open", FileDialog.LOAD);
    fd.show();
    if(fd.getFile() == null){
    //Label1.setText("You have not chosen any image files yet");
    }
    else{
    
    String d = (fd.getDirectory() + fd.getFile());
    //Toolkit toolkit = Toolkit.getDefaultToolkit();
    //Image1 = toolkit.getImage(d);`
    //Object saveImage=Image1;
    insertImage(d) //Db function
    

    then

    public void insertImage(String CUST_ID, String d) throws SQLException {
        try {
                Class.forName(driver);
                con = DriverManager.getConnection(connectionURL);
    
                } catch (SQLException ex) {
                Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ClassNotFoundException ex) {
                Logger.getLogger(Connect.class.getName()).log(Level.SEVERE, null, ex);
                }
        File image = new File(d);      
        FileInputStream fis = new FileInputStream(image);
        stm = con.prepareStatement("insert into customer (PHOTO ) values(?)); //it gives errorr here
        stmt.setBinaryStream(5, fis, (int) image.length());
        //stm.setObject(5,saveImage);
        //stm.executeUpdate();
        stm.execute();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to save an image into a MemoryStream but it is failing
I am currently trying to save a bitmap image, but the background is changing
I'm trying to save contents of an NSView as an image, but, only the
I'm trying to save a copied image from the clipboard but it's losing its
I'm trying to save an image to my sdcard but running into the following
I'm trying to save an image to a folder in .NET C# but I
I am trying to save image to database with Create method. but when try
I'm trying to save an image like this (from an asp.net mvc application): public
outStream = new FileOutputStream(String.format( /sdcard/%d.jpeg, System.currentTimeMillis())); I'm trying to save an image from the
Hello I am trying to save a bitmap image in a basic image editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.