Image not storing in SQLite Database

Hi All
I am creation an application in WPF C# in which i have created an Ink Canavs 
now i want to insert the InkCanvas  Data or stockes in SQLite Database for that i hv created an folder in my application
and on"btnSaveCanvasImg" button Clicked i am saving the image of InkCanvas in a folder and on "btnSaveImgInDatabase" button clicked The saved image stored in the database 
But when i clicked on"btnSaveCanvasImg" button image saved in folder , but when clicked on "btnSaveImgInDatabase" button the image doesn't store in the database.
following is my code
XML:-
<Window x:Class="InkCanvasInDatabase.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="800" Width="600">
    <Grid>
        <InkCanvas Name="MainInkCanvas" HorizontalAlignment="Left" Height="500" VerticalAlignment="Top" Width="595">
            <InkCanvas.Background>
                <ImageBrush ImageSource="C:\Testimonial_Project\Assets\Images\notePaper.png"/>
            </InkCanvas.Background>
        </InkCanvas>
        <Button x:Name="btnSaveCanvasImg" Content="Save Canvas Image" HorizontalAlignment="Left" Margin="33,599,0,0" VerticalAlignment="Top" Width="200" Height="51"
FontSize="20" Click="btnSaveCanvasImg_Click"/>
        <Button x:Name="btnSaveImgInDatabase" Content="Save Image In Database" HorizontalAlignment="Left" Margin="281,599,0,0" VerticalAlignment="Top" Width="238" Height="51"
FontSize="20" Click="btnSaveImgInDatabase_Click"/>
    </Grid>
</Window>
C# Code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Ink;
using System.Windows.Ink.AnalysisCore;
using Microsoft.Win32;
using System.IO;
using System.Data.SQLite;
namespace InkCanvasInDatabase
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        string imagename;
        public MainWindow()
            InitializeComponent();
        public void loadInkAnalyzer()
            InkAnalyzer theInkAnalyzer = new InkAnalyzer();
            theInkAnalyzer.AddStrokes(MainInkCanvas.Strokes);
            AnalysisStatus status = theInkAnalyzer.Analyze();
            if (status.Successful)
                saveInkCanvasBitmap();
            else
                MessageBox.Show("Recognition Failed");
        public void saveInkCanvasBitmap()
            RenderTargetBitmap rtb = new RenderTargetBitmap((int)MainInkCanvas.Width, (int)MainInkCanvas.Height, 0,0, PixelFormats.Default);
            rtb.Render(MainInkCanvas);
            BmpBitmapEncoder encoder = new BmpBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(rtb));
           // FileStream fs = File.Open(@"C:\inkCanvas_Images\test.jpg", FileMode.Create);
            FileStream fs = File.Open(@"C:\Users\xeniun1\Desktop\24.02.2015 Xenium_Project\23.02.2015 InkCanvas\InkCanvasInDatabase\InkCanvasInDatabase\InkCanvas_Images\.jpg", FileMode.Create);
            encoder.Save(fs);
            fs.Close();
        public void insertImgInDatabase()
            byte[] signature;
            using (MemoryStream ms = new MemoryStream())
                MainInkCanvas.Strokes.Save(ms);
                signature = ms.ToArray();
            string stConn = @"Data Source=inkCanvas_DB.db;Version=3";
            SQLiteConnection sqliteConn = new SQLiteConnection(stConn);
            sqliteConn.Open();
            string sql = "INSERT INTO User_Details (User_Text) VALUES (@Sig)";
            SQLiteCommand comm = new SQLiteCommand(sql, sqliteConn);
            comm.Parameters.AddWithValue("@Sig", signature);
            comm.ExecuteNonQuery();
       private void btnSaveCanvasImg_Click(object sender, RoutedEventArgs e)
            loadInkAnalyzer();
            //MainInkCanvas.Strokes.Clear();
            MessageBox.Show("Ink Canvas Save as Image");
        private void btnSaveImgInDatabase_Click(object sender, RoutedEventArgs e)
            insertImgInDatabase();
            MainInkCanvas.Strokes.Clear();
            MessageBox.Show("Ink Canvas Image saved in Database");
Plz provide solution for this 
Regards

Please close your previous threads by marking helpful posts as answer before you start a new one.
The type of the image columns should be BLOB. And make sure that you are looking at the inkCanvas_DB.db in the output folder of your .exe ([your_project_foder]/bin/Debug or [your_project_foder]/bin/Debug) because it is this database that the data gets written
to unless you specify an absolute path in the connection string:
string stConn = @"Data Source=C:\Your_Project_Folder\inkCanvas_DB.db;Version=3";
Please upload a reproducable sample of your issue to OneDrive and post the link to it here for further help.
And please remember to close your threads by marking helpful posts as answer.

Similar Messages

  • Moving images not stored in Aperture Library to Aperture Library

    I have some images not stored in my Aperture Library that I would like to have stored in my Aperture Library without having to reimport. I have already made adjustments to them. I just realized that when I imported them I did not have the setting to put them in my Aperture Library selected.
    What a day... : (
    Thanks all.

    The albums organization remains the same, simply select the images in the browser and go to File-Consolidate Master. That moves (or copy) the master file to the Library. The links to albums are updated automatically.

  • Aperture & iPhoto metadata when images NOT stored in iPhoto

    Thinking of "upgrading" to Aperture from iPhoto '11 - still want to use iPhoto for organization but Aperture for hopefully better editing capabilities, etc.
    Have 30,000+ images with keywords, etc. in iPhoto; the image files are NOT stored IN iPhoto, i.e., they are organized in folders external to iPhoto's library. The iPhoto library file best I can tell stores thumbnails and keyword metadata, etc.
    I'd like to use Aperture and have access to all of iPhoto's keywords, etc. but to use the original photo files.
    Can Aperture be setup to work this way? i.e., to pull in the 30,000+ photos' keywords yet reference the same originals that iPhoto is referencing?
    I don't want to duplicate the 30,000+ originals... In all likelihood I'd only ever want to manipulate a small percentage of the total image library in Aperture.
    Any suggestions appreciated!
    Alex

    Alexander Mcleod wrote:
    Thank you for taking the time to reply...
    re: "Basically to edit an image, stored in iPhoto, in Aperture you would have to export the image from iPhoto import into Aperture modify it export it out of Aperture and import it back into iPhoto."
    My point is that in my case the images are NOT *stored* IN iPhoto...
    Yes I understand, your iPhoto library is setup using referenced masters, the termed used when the master file is stored outside of the programs database. And you could setup Aperture in the same way and they would both be pointing to the same master file, external to both programs databases.
    But here's here's the kicker: The master file *is never modified* by either program. I believe iPhoto makes a copy of the master when you apply adjustments (someone with a greater understanding of iPhoto can correct me here) how it does it isn't important what is important is that he master isn't modified; Aperture also leaves the master alone. It records the adjustments you make as a stream on instructions and applies those to the master when you want to create an adjusted image. What you see (normally) in Aperture's views are previews of the adjusted image. So changes you make in Aperture won't be seen in iPhoto because iPhoto is looking at the original master file, not Aperture's adjusted version.
    Now you can share the preview from Aperture with iPhoto, but at this point you basically have the adjusted image in two places.
    And in reference to the other response that suggests that iPhoto and Aperture use different databases, I'd completely expect that to be the case. What I'm wondering about is can Aperture initialize its database from iPhoto's database; i.e., create its equivalent to iPhoto's "library" file (where all the iPhoto metadata is stored) from iPhoto's AND like iPhoto reference the original files in their original location.
    Yes Aperture can initialize a database of its own based on the iPhoto library and that library can be setup to use referenced masters, see above.
    I don't see why I'd need to 'export' any image from iPhoto (unless of course I'd "edited" it in iPhoto - in which case the *modified* file IS I think stored IN iPhoto's library) but that's my point... I don't WANT to edit the files with iPhoto... I want to edit the files with Aperture.
    You're right you won't need to export from iPhoto if you setup both with referenced masters. But like I said above to get back to iPhoto you will have to export from Aperture unless you can live with using the previews in iPhoto. But again you will basically have two identical library structures, at least at start, as time goes on they will diverge.
    I hope this better clarifies what I'm trying to explain.
    It does, I hope my reply also helps explain the difficulties with this setup and why it's not as cut and dry as it first appears.
    I have read *many* other posts that point out what you're pointing out but they all seem to make assumptions about wanting to modify files in Aperture which were previously *modified* in iPhoto. The unmodified "original" photos (assuming both iPhoto and Aperture have the ability that iPhoto has to reference the original files from a location *external* to iPhoto) are then by definition are already shared between iPhoto and Aperture so there's no need to 'export' from one to the other, no?
    As I've said whats shared is the original unmodified master image. Once either program modifies it it is no longer shared.

  • Can I use iPhoto to view and edit images not stored in the iPhoto Library

    Hi folks,
    I'm a newbie to Mac after 20+ years on PC...just switched 2 weeks ago....wish I'd done it years ago. Everythings so easy and fast...e.g. setup wireless broadband in 25 mins with no probs....and I have never done anything like that.
    Here's my Q.
    I have a load of images, downloads and scans, of old manuscripts, authors etc. which I don't really want in my iPhoto library (which I would like to keep for actual photos. Is it possible to point iPhoto to another location (say in Documents) where it will let me view and edit these images without importing them into the library.
    Alternatively can I view images as thumbnails in this other locations, and not as default file type icons.
    Hope this is plain,
    JP_MAC
    Imac G5 17" 1.9Ghz   Mac OS X (10.4.3)  

    Hi jp-mac,
    iPhoto 5 imports all images into it's own database. (this has changed with iPhoto 6 so you might want to check out iLife 6)
    The other files you want to view but not have in the library...are they image files?
    If so, you can view that folder as icons and then make the icons larger so you can see what they are.
    To do this open the folder in question. click the first icon on top of View in the toolbar. This will make that folder contents view as icons
    Now go all the way to the top of your screen and click on View>show view options.
    Slide the icon size slider all the way to the right to view them larger. Also make sure you have the "show icon preview" checked.
    This will work most of the time, but sometimes if you edit images in other applications they might not make icon previews, so check their preferences to make sure you have that checked.
    There is also a little third party program that will do it for you.
    One is called Pic2Icon
    Pic2Icon
    Another one is a contextual menu item called QuickImageCM.
    QuickImageCM
    check out that page because there are some other useful contextual menu items that I use all the time.

  • When I select from the LOV, it is not storing in the database

    Have a field (Manager) where the user selects their manager from the select list(generated from the query below)
    select FIRST_NAME || LAST_NAME d, MANAGER_ID r
    from PERSONNEL
    where TITLE = 'MGR'
    order by 1
    After the manager is selected and Apply changes is clicked, nothing is stored to the database.
    Have the Manager field specifications set as:
    Source Used: Only when current value is session state is null
    Source Type: Database column
    Maintain Session State: Per Session
    Source Value or Expression: MANAGER_ID

    Well, how have you created this form... manually or using wizard. If you have used wizard, then it would have asked you to select the table and it would have created process to update the same.
    If you have created this form manually then you need to add a processs to update this to database...
    Regards,
    Shijesh

  • Image path not storing in sql database

    Hello,
    I have read here on the forum how to upload an image to server and store path in  your database, the image uploads correctly to the correct folder on my server but the image path does not get stored on my sql database (not local hosting). I receive the error: The file has been uploaded, and your information has been added to the directory. Column 'image' cannot be null.
    My database has the following columns:
    id
    datum
    image
    sectie
    My code is as follows:
    <?php require_once('Connections/dbTroch.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_dbTroch, $dbTroch);
    $query_rs_aanbod = "SELECT * FROM tblSlideshow ORDER BY id ASC";
    $rs_aanbod = mysql_query($query_rs_aanbod, $dbTroch) or die(mysql_error());
    $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    $totalRows_rs_aanbod = mysql_num_rows($rs_aanbod);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    $target = "images/slides/";  //This is the directory where images will be saved// 
    $target = $target . basename( $_FILES['image']['name']); //change the image and name to whatever your database fields are called//
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add-photos-aanbod")) {
      $insertSQL = sprintf("INSERT INTO tblSlideshow (image, sectie) VALUES (%s, %s)",
                           GetSQLValueString($_POST['file'], "text"),
                           GetSQLValueString($_FILES['image']['name'], "text"));
    //This code writes the photo to the server//
    if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
    //And confirms it has worked//
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
    else {
    //Gives error if not correct//
    echo "Sorry, there was a problem uploading your file.";
      mysql_select_db($database_dbTroch, $dbTroch);
      $Result1 = mysql_query($insertSQL, $dbTroch) or die(mysql_error());
    ?>
    <!doctype html>
    <html>
    <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Troch Project Solutions - Admin - Toevoegen</title>
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/layout.css" />
      <!-- Fonts
      ================================================== -->
      <script type="text/javascript" src="//use.typekit.net/vob8gxg.js"></script>
      <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
      <!-- jQuery
      ================================================== -->
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
      <script src="js/vendor/modernizr.js"></script>
    </head>
    <body>
        <div class="row">
          <div class="large-8 medium-8 small-8 large-centered medium-centered small-centered columns intro">
              <h2 class="subheader text-center">Admin</h2>
              <p><a>Log uit</a></p>
              <p><a href="admin.php">Terug naar Admin menu</a>
              <h4>image toevoegen naar aanbod slideshows:</h4>
              <form action="<?php echo $row_rs_aanbod['']; ?>" method="POST" name="add-photos-aanbod" id="add-photos-aanbod" enctype="multipart/form-data">
              <table>
                    <tbody>
                         <tr>
                              <td><label for="image">Kies foto:</label></td>
                              <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
                        <tr>
                              <td>Sectie:</td>
                              <td><select name="sectie" id="sectie" option value="sectie">
                                <?php
    do { 
    ?>
                                <option value="<?php echo $row_rs_aanbod['sectie']?>"><?php echo $row_rs_aanbod['sectie']?></option>
                                <?php
    } while ($row_rs_aanbod = mysql_fetch_assoc($rs_aanbod));
      $rows = mysql_num_rows($rs_aanbod);
      if($rows > 0) {
          mysql_data_seek($rs_aanbod, 0);
          $row_rs_aanbod = mysql_fetch_assoc($rs_aanbod);
    ?>
                              </select></td> 
                        </tr>
                        <tr>
                            <td><input type="Submit" name="Add" id="add" value="Toevoegen" /></td>
                        </tr>
                </tbody>
            </table>
            <input type="hidden" name="MM_insert" value="add-photos-aanbod" />
        </form>
          </div><!-- end large-8 -->
        </div><!-- end row -->
    <script src="js/vendor/jquery.js"></script>
    <script src="/js/vendor/fastclick.js"></script>
    <script src="js/foundation.min.js"></script>
    <script>
                $(document).foundation();
            </script>
    </body>
    </html>
    <?php
    mysql_free_result($rs_aanbod);
    ?>
    I cannot work out what is wrong and I would appreciate any help on this. Thanks

    Your form field and array variable names do not match
    <td><input name="image" type="file" id="image" value="<?php echo $row_rs_aanbod['image']; ?>" /></td>
    GetSQLValueString($_POST['file'], "text"),

  • Upload and Resize Image not inserting filename in database

    I have a form that I created using the insert record form wizard. One of the fields is a file field and my form enctype is set to multipart/form-data. I then used the upload and resize image behavior and set the parameters. When testing the form the file uploads to the correct directory but no entry is made into the database for that particular field. The other fields are entered into the database just fine. If it helps, here is the code generated before the  tag:
    <br />
    <br /><?php require_once('../../Connections/test.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('../../includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('../../includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("../../");<br /><br />// Make unified connection variable<br />$conn_test = new KT_connection($test, $database_test);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />//start Trigger_ImageUpload trigger<br />//remove this line if you want to edit the code by hand <br />function Trigger_ImageUpload(&$tNG) {<br />  $uploadObj = new tNG_ImageUpload($tNG);<br />  $uploadObj->setFormFieldName("picture");<br />  $uploadObj->setDbFieldName("picture");<br />  $uploadObj->setFolder("../images/");<br />  $uploadObj->setResize("true", 120, 0);<br />  $uploadObj->setMaxSize(1500);<br />  $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png, bmp");<br />  $uploadObj->setRename("auto");<br />  return $uploadObj->Execute();<br />}<br />//end Trigger_ImageUpload trigger<br /><br />// Make an insert transaction instance<br />$ins_team = new tNG_insert($conn_test);<br />$tNGs->addTransaction($ins_team);<br />// Register triggers<br />$ins_team->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");<br />$ins_team->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$ins_team->registerTrigger("END", "Trigger_Default_Redirect", 99, "../team.php");<br />$ins_team->registerTrigger("AFTER", "Trigger_ImageUpload", 97);<br />// Add columns<br />$ins_team->setTable("team");<br />$ins_team->addColumn("id", "NUMERIC_TYPE", "POST", "id");<br />$ins_team->addColumn("sort", "NUMERIC_TYPE", "POST", "sort");<br />$ins_team->addColumn("name", "STRING_TYPE", "POST", "name");<br />$ins_team->addColumn("title", "STRING_TYPE", "POST", "title");<br />$ins_team->addColumn("description", "STRING_TYPE", "POST", "description");<br />$ins_team->addColumn("picture", "FILE_TYPE", "FILES", "picture");<br />$ins_team->setPrimaryKey("id", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsteam = $tNGs->getRecordset("team");<br />$row_rsteam = mysql_fetch_assoc($rsteam);<br />$totalRows_rsteam = mysql_num_rows($rsteam);<br />?>

    If the reason is about memory, warning message should be happened when upload the image, because "show thumbnail" means resize at second time, how come you failed to resize the picture that system let it upload succeed at the first time by the same resize process?
    upload procedure
    a.jpg: 2722x1814, 1.2mb
    upload condition: fixed width 330px, 1.5mb
    "upload and resize" a.jpg -> file upload -> "resize engine" -> passed (but not work and no warning message)
    "show thumbnail" a.jpg -> "resize engine" -> failed (not enough memory)
    it doesn't make sense.
    and you miss an important key point, I upload the same picture myself, and resize work, so I said it happened at random, and that's why I am so worried.

  • Selection of Cropped Image not stored

    If I crop an Image in Lightroom 5, sometimes the new selection will not be stored, after I edit another image. In the preview the selection is correct, but as soon as I select the image again the cutout moves a little bit.
    Is there a solution so that the selection is stored correctly?

    I see the opposite: LR2 used to crop to much when Zooming to fill. LR3 fills just right.
    Windows XP.

  • Externally edited image not stored with referenced files?

    When I open an image in the external editor, do my work in PS, and then save, the new file is located in the Aperture Library even though the master for the image is a referenced file. Is there any way to change this so the new images will be placed in the same folder as the referenced images? Thanks...gary
    mac book, G5 dual   Mac OS X (10.4.8)  

    I'm afraid for the moment you have to do it manually by selecting the image and going to File/Relocate Master.
    We should have and option in Aperture to allow us to have ALL the images in an external location.

  • Generating sequence numbers not stored in the database

    how to generate row numbers in the select statement
    I need my query to return row numbers as a column which need to be displayed in the front end reporting tool.
    should return something like this..
    RANK NO DEPTID DEPT_NAME
    1 10 SCOTT
    2 10 JAMES
    3 20 PETER

    Something like
    SELECT row_number() over (order by deptid) rank_no, deptid, dept_name
      FROM deptJustin

  • Image compressed and stored in the database.

    Hi,
    We have a tiff file stored in the database and then compressed using the following Intermedia Oracle method.
    process ('compressionFormat=FAX4,maxScale=1696 2200'); and save it back in the database.
    This oracle database is 8.1.7.4. The tiff file gets processed when we use TIFF file generated by old scanner but errors out with the TIFF file generated by latest scanners.
    The error I get is ORA 29400 , IMG-00704.
    There is a difference in TIFF version in the outputs generated by two scanners,
    The compression option : TIFF modified G3 in the old one
    while the new one has Lempel-Ziv
    Also, the tiff is loaded and saved fine but the image gets corrupted after the intermedia process method is run.

    Thank you for your reply.  I am glad to find that I did not miss an option.  I was aware that I could move my pictures into some other folder, but you have forgotten the solution that I chose.  That was to go back and use ZoomBrowser, which works to access photos in any folder I choose.  In addition it loads promptly.  I have only spent a brief time using the ImageBrowser but don't recall seeing any enhancements that over ZoomBrwoser.  Perhaps if I was attempting to interface with other software but as a stand-alone product, well perhaps you could enlighten me as to what makes ImageBrowser EX a better product..  Regarding the Accept as Solution: are you implying that Canon restricts their search function to only those responses that the OP marks as accepted?

  • Display images stored in the database

    I have images stored in the databse. I followed the steps provided in the oracle documentation. Now i want to retrive the image from the database into a java object that can be dislayed in , say, a JLabel. I am able to retrieve the image from the database into the OrdImage in the oracle.java.ord package and view the properties of the image. But unable to retrive the image as such to be displayed.
    Thanking You
    vinay

    This might help...
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import javax.swing.*;
    import java.awt.*;
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.* ;
    import oracle.ord.im.*;
    import java.awt.event.*;
    public class HelloDBImage implements ActionListener{
    OracleConnection con = null;
    JLabel label = null;
    String textFieldString = "Image ID entered";
    public void actionPerformed(ActionEvent e)
    String prefix = "You typed \"";
    if (e.getActionCommand().equals(textFieldString))
    JTextField source = (JTextField)e.getSource();
    ImageIcon imgIcon = createImageIcon(source.getText());
    if (null != imgIcon)
    // Create image Label
    label.setText(null);
    label.setIcon(imgIcon);
    else
    label.setIcon(null);
    label.setText("Image not found! ");
    source.setText("");
    label.repaint();
    //actionLabel.setText(prefix + source.getText() + "\"");
    public ImageIcon createImageIcon(String key)
    Image image = null;
    ImageIcon imgIcon = null;
    try
         // Connect to the database if necessary
    if (null == con) con = connect();
    // Create Input Stream from DB image.
    InputStream is = new BufferedInputStream(
    getDBInputStream(con, key));
    if (null != is)
    // Create Image from Image Input Stream
    ImageInputStream iis = ImageIO.createImageInputStream(is);
    image = ImageIO.read(iis);
    // Create Image Icon from ImageInputStream
    if (null != image) imgIcon = new ImageIcon(image);
    } catch (Exception e)
    System.out.println("exception raised " + e);
         e.printStackTrace();
    return imgIcon;
    public Component createPanelAndContents(String key)
    // Create the image label
    ImageIcon imgIcon = createImageIcon(key);
    if (null != imgIcon)
    // Create image Label
    label = new JLabel(imgIcon);
    else
    label = new JLabel("Image not found! ");
    // Create layout
    GridBagLayout gridBag = new GridBagLayout();
    // Create panel to draw in
    JPanel pane = new JPanel();
    pane.setLayout(gridBag);
    GridBagConstraints c = new GridBagConstraints();
    JScrollPane scrollPane = new JScrollPane(label,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    gridBag.setConstraints(scrollPane, c);
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    scrollPane.setMinimumSize(new Dimension(300, 300));
    pane.add(scrollPane, c);
    // Add a text field and label to get anoter image
    JTextField textField = new JTextField(10);
    textField.setActionCommand(textFieldString);
    textField.addActionListener(this);
    // Add fields for input
    JLabel promptLabel = new JLabel("Please enter DB key: ");
         pane.add(promptLabel);
    pane.add(textField, c);
    return pane;
    public static void main(String[] args)
    String key = "1";
    try
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) { }
    //Create the top-level container and add contents to it.
    JFrame frame = new JFrame("SwingApplication");
    HelloDBImage app = new HelloDBImage();
    if ((args.length > 0) && (args[0] != null)) key = args[0];
    System.out.print("length= " + args.length + "/" );
    if (args.length > 0) System.out.println(args[0]);
    Component contents = app.createPanelAndContents(key);
    frame.getContentPane().add(contents, BorderLayout.CENTER);
    //Finish setting up the frame, and show it.
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);
    public InputStream getDBInputStream(OracleConnection con, String key)
    InputStream is = null;
    try
         int index = 0;
         Statement s = con.createStatement();
         OracleResultSet rs =
         (OracleResultSet)s.executeQuery("select * from images " +
    "where item_id = " + key );
         if (rs.next()) // Just get first image if more than 1.
         index = rs.getInt(1);
         OrdImage imgObj =
    (OrdImage) rs.getCustomDatum(2, OrdImage.getFactory());
    is = imgObj.getContent().getBinaryStream();
    catch(Exception e)
    System.out.println("exception raised " + e);
    e.printStackTrace();
    return is;
    public OracleConnection connect() throws Exception
    String connectString;
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    connectString = "jdbc:oracle:oci8:@orcl";
    OracleConnection con = (OracleConnection)
    DriverManager.getConnection(connectString,"scott",
                        "tiger");
    con.setAutoCommit(false);
    return con;

  • How to display Images stored in a database using javascript

    Hi.
    I have some images stored in a table and I need to display them using javascript. The images are stored in BLOB columns: I would like to know if I can put them on a directory and then get it from there using BFILENAME function.
    Any suggestion?
    Regards,
    Jeannine

    Hi All,
    Yes DuraiRaja - i am using the document.getElementById(' ').
    In my app, I have a Main controller calling a View - Default.HTM,
    This Default.HTM, in turn loads up three trays T1, T2, T3 and these tray elements in turn call up the controllers ctrl1, ctrl2, ctrl3 associated to them.
    CTRL1 calls a view - View1 - V1.htm, which has the below code.
    And on the below page all that i am trying to do is validate if "FieldVal" is blank or not.
    I get an error on IE as "Object required"
    I get a HTTP 501/505 error when i try to upload the code.
    Thanks all !

  • [SOLVED] PowerDNS (pdns) - SQLite database '...' does not exist yet

    PowerDNS 3.2-5 is having some issues connecting to my backend database (sqlite3).
    beta powerdns # tail /var/log/errors.log
    May 7 20:12:41 localhost pdns[19098]: Caught an exception instantiating a backend: Unable to launch gsqlite3 connection: SQLite database '/etc/powerdns/database.sqlite' does not exist yet
    But when i do:
    beta powerdns # sqlite3 /etc/powerdns/database.sqlite
    SQLite version 3.7.16.2 2013-04-12 11:52:43
    Enter ".help" for instructions
    Enter SQL statements terminated with a ";"
    sqlite> select * from domains;
    1|<myhostname>|||NATIVE||
    sqlite>
    sqlite3 It fetches the records and domains to my liking but not PowerDNS.
    Same thing goes for a blank db without any domains or records, i can query it but not PowerDNS.
    Followed this guide in order to setup the proper tables and columns: http://doc.powerdns.com/html/gsqlite.html#idp9379264
    (without the DNSSEC part, i'll give that a go later on)
    It obviously loads the sqlite3 module, and tries to connect to the backend, which doesn't work, so the ArchLinux package is fine i'm guessing.
    More info:
    * Link to package: https://www.archlinux.org/packages/comm … 6_64/pdns/
    * chmod == 777
    * chown == nobody:nobody (and tried root:root as default)
    * running as root (not pdns)
    Last edited by Torxed (2013-05-08 10:52:05)

    Solved it.
    The guides are vague in this regard but once you've just read the config twice you'll understand the logic.
    First of all, no absolute paths for sqlite3, it should be:
    launch=gsqlite3
    gsqlite3-database=database.sqlite
    Secondly, find your chroot, and point it to your database location or put your database here (whichever):
    chroot=/var/empty
    The folder structure should be:
    /var/empty/database.sqlite
    And this py pointing to ./database.sqlite when starting sqlite3 in pdns, it should be able to lock on to the database.
    Peachy!

  • BPEL Workflow email not stored in database!

    Hi,
    I'm using SOA Suite 10.1.3.4. I have a worklist application where notifications are sent to Assignees, Approvers when the action is Assign or Approve. The mails are delivered as expected. But there is not trace of emails sent. I checked WFNOTIFICATION in ORABPEL Schema. The tables are empty.
    Could anyone help me in fixing this issue.
    1. Why email notification sent are not stored in database?
    2. Is there any other means that we can track the email sent?
    3. Do we need to configure in SOA server to store the email notifications in the database.
    Thanks in advance.
    Regards,
    Pradeep

    Hi Pradeep,
    i am also facing the same proublem. let me know the update if you get anythnig regarding to this.
    thanks,
    Hari

Maybe you are looking for

  • Animated gifs in keynote for iPad

    I realized, in Excel 2011 (Mac) a ppt with links "simple" and I want to incorporate animated GIFs (or videos). Everything works smoothly on Power Point, however, upon transfer of the Ipad and opening files  with Keynote my animated gifs are no longer

  • OBIEE 11G Embedded Image not displayed on PDF

    Hi I have some embedded images on a dashboard. On the screen the images are displayed without problems. But if we want to print the dashboard (f.e. PDF) the images are not printed. In html-view the images would be displayed. All the images are refere

  • Calling the super class method from the subclass

    Hi all, I have a question about inheritence and redefinition of methods. Is it possible to call the superclass implementation of a method which is redefined in the subclass in another method of the subclass?There are possbilities like creation of an

  • Text created by Typewriter in a PDF file merging into the original file

    When I use typewriter tool to add text onto a PDF file, is there any way to make the text boxes NOT selectable. Basically I want to know if there's a way to merge the text boxes to the original PDF file.

  • Open a QueryView from Portal in SAP Analyzer

    Hey guys, I have a Query Q1 and a view V_Q1 which was created in SAP Analyzer 7.0.  I know how to publish V_Q1 to Portal, see http://help.sap.com/saphelp_nw70/helpdata/en/33/39fa40ee14f26fe10000000a1550b0/content.htm But using the tecnique above, V_Q