Insert photos in a database and associate the photo to a person

I am creating a database that maintains a person's personal information,so i would like to know how to insert photos related to each person and associate the photo to the person and whenever i want to know about a particular person, it should display all his information along with the photo .and also I should be able to search a person by his photo .Please let me know ASAP.
Thank you

It is possible to store photo/image as blob field in the same table or a seperate table.
table EMP
empid (PK)
empname
dept
table EMP_PHOTO
empid (PK)
photo BLOB
and also I should be able to search a person by his photo Use Intermedia
http://www.psoug.org/reference/intermedia_a.html
http://www.psoug.org/reference/intermedia_v.html

Similar Messages

  • Jasper report on HTML when one image loaded from database and for the other

    How to generate jasper report on HTML when one image loaded from database and for the other we give a image path
    My code
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
              exporter = new JRHtmlExporter();
              exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
              exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
              exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);
         exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);
         exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);
         exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
         exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
              exporter.exportReport();
              byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();
    Can any one help pls
    Message was edited by:
    ameet.au

    hey sorry for posting it in this forum.
    but do u have sample code for making it work.. since i am able to do it on PDF format(image from Database and another stored in the webserver) using
    byte image[] =(byte[]) outData.get("image");
                        ByteArrayInputStream img = new ByteArrayInputStream(image);
                        hmimg.put("P_PARAMV3", img);
    print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);
    bdata= JasperExportManager.exportReportToPdf(print);

  • How to insert row in table control and save the data in tables

    Hi,
    I have one table control i am displaying data into table control ,
    my problem is : i want to display data into read mode in table control.
    but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
    please give me solution
    main problen is  how can know inserted line in table control and pass that data into ztable.

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

  • Unix Script to connect to Portal Database and move the files to XI Server

    Hi all,
    we have a requirement where the source BW system is placing files in Content Management in the link http://xxx:50100/irj/go/km/docs/documents/Public%20Documents/HFM.
    XI needs to read the files from the above location.Since the files are stored in Portal database,we cant do FTP to this location.
    So we have been asked to write a script which connect to this location and moves the files to XI directory.
    Can someone plz help me with this script?

    The concern has been discussed earlier at
    here and should be helpful to check the database size and free available space in exchange server.
    This blog has also good explained about "how to count mailbox per database in exchange 2010". Please check this :
    http://blog.powershell.no/2010/11/21/retrieve-number-of-mailboxes-per-database-in-exchange-server-2010/

  • Restore exchange 2010 mailbox from database and restore the mailbox to pst file

    Hello,
    I'm running exchange 2010Sp2 rollup5 ver2, the mailbox database in question is in a DAG.  The databases are being backed up by commvault. 
    So, I received a request to restore a couple mailboxes from 10 days ago and export the mailbox to PST file for archiving. 
    How would you go about the restore.  I'm thinking the database needs to be offline, so I don't mistakenly overwrite my production databases.
    Where should backup guy restore the database/log file (completely separate server from my mailbox servers?)
    Once database/logs are restored, what is the procedure to make the mailboxes visible
    Once the mailboxes are visible, what is best way to restore one to a PST file?
    thanks in advance for all your help.

    Hi
    For DB Restores with commvault you have to reed the product documantation.
    The Database must not be offline.
    I would recommend to try the following steps:
    1. Create Recovery DB on Exchange
    http://terenceluk.blogspot.ch/2013/06/restoring-mailbox-from-exchange-2010.html
    2. Restore to this Recvovery DB from Commvault
    (Commvault Administration Guide)
    http://documentation.commvault.com/hds/release_9_0_0/books_online_1/english_us/pdf/exchange_db_admin.pdf
    3. Restore to a temporary Mailbox and take a PST
    Restore Mailbox from Recovery Database
    http://technet.microsoft.com/en-us/library/bb125218(v=exchg.141).aspx
    Create the PST with Outlook or Exchange Powershell Export Requests
    http://technet.microsoft.com/en-us/library/ee633479(v=exchg.141).aspx
    Georg

  • Inserting sequence value from JDBC and getting the same value back

    Hi: Gurus I have a table whose primary key is a sequence. I wonder how to make sure I get the same sequence value back for current transaction so I update the other table whose foreign key is the sequence value from first table.
    E.g lets say I do this
    String query_insert = INSERT INTO table1 (column1, ....) VALUES (HIGHLIGHT_ID_SEQ.nextval, ...);
    pstmt = con.prepareStatement(query_insert);
    pstmt.executeUpdate();
    How I make sure no other transaction update the sequence value so I can read the last inserted sequence value and update the second table with this value
    String query_select = "SELECT HIGHLIGHT_ID_SEQ.currval FROM DUAL";
    pstmt = con.prepareStatement(query_select);
    Regards,
    Rashid.

    <rant>No version again. I wonder why people requiring help want to stay anonymous and never want to type their version, only 4 digits. In this case, jdbc, not only the version of the driver is important, but also it's type. Waving a magic wand again? </rant>
    Look up the returning into clause of the insert statement in the sql reference manual for your version.
    Sybrand Bakker
    Senior Oracle DBA

  • Insertion in XML Type table and fetching the data in Pro*C

    I have a Pro*C program written which populate one temp table. That temp table is used for writing the records to a flat file and then the table is purged by this program itself. Now my requirement is to write a new procedure in this progarm which simultaneously populate new XML Type table. Also i have to write some other procedures/functions to query the XML type table
    in Pro*C. I am new to XML part of database. Could somebody suggest how to go ahead with this problem

    Please check the Oracle Database 10g: XML DB Developer's Guild for example.

  • Insert URL link into SMARTFORMS and retrive the picture linked to the URL

    Hi Guys,
    I have the following problem:
    I have a URL link and I want to set this link into the smartforms and
    I want to retrieve the picture linked to the URL and display the picture in the print.
    Is it possible?
    Thanks for your support.
    Best regards,
    Giulio

    Hi
    Check the Tcodes
    OAOR and
    SMW0
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Inserting a node in XML and retaining the doc type

    Hi All,
    I want to insert one new node in an XML. Using the following code I can do that. But the problem is if the XML has doc type declaration then its giving me problem. After inserting the node the transformer is removing my doc type declaration from the XML. I have to retain the doc type definition (including entity declaration) as it is in the original XML file.
    The following is the code that I'm using.
    Document vDoc = null;
    try {
    // Contruct the DOM document
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    vDoc = builder.newDocument();
    Node vFormNode = vDoc.createElement("Form");
    vDoc.appendChild(vFormNode);
    // Convert into a String the DOM document
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    DOMSource source = new DOMSource(vDoc);
    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    transformer.transform(source, result);
    catch (Exception e) {
    System.out.println("Error: " + e.getMessage());
    }The doc type def. in the original file is some thing like this.
    <!DOCTYPE article SYSTEM "someurl/TFJA.dtd"[
    <!ENTITY T0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_T0001.gif" NDATA GIF>
    <!ENTITY F0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0001g.gif" NDATA GIF>
    <!ENTITY F0002 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0002g.jpg" NDATA JPEG>
    ]>I know that I can set up the doc type definition in the new XML using the following properties of the transformer.
    transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM,"article" );
    transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC,"my DTD def");
    I cannot hard code the DTD def. as it can vary from one XML to another. Using doc.getDocType() I can get the doctype of the original XML. But is it is not returning the complete def. including entities declaration. Its giving me "someurl/TFJA.dtd".
    Is there any way to retain the complete doc type in the original XML file? I don't have much experience in XML and this issue is eating my head.. Also do I have to modify the DTD to accommodate the new tags added in order to make it a valid XML?
    Any help and sample code would be highly appreciated.

    Hi,
    I also had similar requirement and when searching i came across this post. Later i found the solution for this. Instead of hardcoding the doctype you can get it from Document as follows..Snippet from the code i used..
    DocumentType doctype = document.getDoctype();
    if(doctype != null) {
                   String id = doctype.getSystemId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, id);
                   id = doctype.getPublicId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, id);
    Hope this helps.
    Regards,
    Deepak

  • Adding a field/column in sql table/database and adding the same field /column in biztalk schema

    I have a biztalk application that has a source schema and destination schema inside a map.
    A new field/column in the sql database has been created. Now I have to add this field/record to my source schema.
    My question is, do I manually add this field/record to my source schema and update my source map or do I have to generate a new schema using add generated items>consume adapter service>sql and update my source map ?

    You would need to add the fields to the message schema your SQL data is mapped onto.
    Also update the SQL statement which is executed inside your sql adapter settings to return the new columns.
    Rachit
    Please mark as answer or vote as helpful if my reply does

  • Saving images on my database and calling the open file dialog

    i want to be able to save image in my database or alternatively save them on a file system. meanwhile i want to allow them choose the name of the image in the folder by using the win_api_dialog.open_file. My platform is win2000. do i need to add any other thing to this like a particular library or just anything. please i need this help urgently.database os is unix ware.

    Hello,
    You can do this without using library. Suppose you have a table with BLOB data type column and one form which has image box to display and store image boxes.
    Now by using READ_IMAGE_FILE read picture file. To write picture to file use WRITE_IMAGE_FILE. and
    if you want to give users open file dialogue box then use GET_FILE_NAME builtin.
    All the best.
    Adinath Kamode

  • Can you setup CDC on Replicated Database and not the source database

    I just want to confirm the following:
    Can you setup Change Data Capture on the replicated database. (SQL 2008 R2, SQL 2012)
    To be clear CDC will not be setup on the source server database, it will only be setup on the replicated database.
    Everything I've read so far says you can but there are pit falls and probably is not a good idea.
    What are the pros and cons?
    What is best practice.

    Yes, you can.
    Have you seen this article?
    http://blogs.msdn.com/b/repltalk/archive/2010/04/19/change-data-capture-best-practices.aspx
    I use replication all the way. You can replicate to a different table of a different schema in the same database. In most cases where people do cdc I find that they can use replication to achieve the same goals.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • How do I join two tables in the same database and load the result into a destination table in a SSIS package

    Hi,
    I have a query that joins two tables in the same database, the result needs to be loaded in a destination DB table.  How do I do this in SSIS package?
    thank you !
    Thank You Warmest Fanny Pied

    Please take a look at these links related to your query.
    http://stackoverflow.com/questions/5145637/querying-data-by-joining-two-tables-in-two-database-on-different-servers
    http://stackoverflow.com/questions/7037228/joining-two-tables-together-in-one-database

  • Problem with storing key into database and decrypting the password.....

    Hi every one, i have prob with this code
    import java.security.NoSuchAlgorithmException;
    import java.sql.Blob;
    import java.sql.ResultSet;
    import javax.crypto.KeyGenerator;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.SecretKey;
    import java.security.Key;
    import java.io.*;
    import java.security.InvalidKeyException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import javax.crypto.BadPaddingException;
    import javax.crypto.Cipher;
    import javax.crypto.IllegalBlockSizeException;
    public class SecurityUtil {
    public static final String ALGORITHM ="DES";
    public static Cipher cipher;
    SecurityUtil() throws NoSuchAlgorithmException, NoSuchPaddingException {
    cipher = Cipher.getInstance(ALGORITHM);}
    public static void serializeKey(Key key, File file) {
    //serializing
    try {     FileOutputStream fos = new FileOutputStream(file);
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    oos.writeObject(key);
    oos.flush();
    oos.close(); } catch (Exception e) { System.out.println("Exception during serialization: " + e);
    System.exit(0); } }
    public static SecretKey deserializeKey(File file) {   //deserializing
    SecretKey key1 = null;
    try {  FileInputStream fis = new FileInputStream(file);
    ObjectInputStream ois = new ObjectInputStream(fis);
    key1 = (SecretKey) ois.readObject();
    ois.close();
    System.out.println("object2: " + key1); } catch (Exception e) {
    System.out.println("Exception during deserialization: " + e);
    System.exit(0);}
    return key1;
    public static byte[] encrypt(String input, SecretKey key) throws InvalidKeyException, BadPaddingException,
    IllegalBlockSizeException {
    cipher.init(Cipher.ENCRYPT_MODE, key);
    byte[] inputBytes = input.getBytes();
    return cipher.doFinal(inputBytes);
    public static String decrypt(byte[] encryptionBytes, SecretKey key) throws InvalidKeyException,
    BadPaddingException, IllegalBlockSizeException {
    cipher.init(Cipher.DECRYPT_MODE, key);
    byte[] recoveredBytes = cipher.doFinal(encryptionBytes);
    String recovered = new String(recoveredBytes);
    return recovered;
    public static void main(String[] args) throws Exception {
    SecurityUtil su = new SecurityUtil();
    // SecurityUtil.testUsingSerialization();
    SecurityUtil.testWithDatabase();
    public static void testUsingSerialization() throws Exception {
    KeyGenerator kg = KeyGenerator.getInstance("DES");
    kg.init(56); // 56 is the keysize. Fixed for DES
    SecretKey key = kg.generateKey();
    File file1 = new File("root:/testKey.key");
    serializeKey(key, file1);
    SecretKey deserializedKey = deserializeKey(file1);
    byte[] encryptionBytes = encrypt("input", key);
    System.out.println("Recovered: " + decrypt(encryptionBytes, deserializedKey));
    public static void testWithDatabase() throws Exception {
    KeyGenerator kg = KeyGenerator.getInstance("DES");
    kg.init(56); // 56 is the keysize. Fixed for DES
    SecretKey key = kg.generateKey();
    boolean insertResult = insert("prasunay","prasunay",key);
    System.out.println("<<======= insert result: " + insertResult);
    boolean validateAuthenticationDetails = validateAuthenticationDetails("prasunay","prasunay");
    System.out.println("<<======= right values:" + validateAuthenticationDetails);
    boolean validateAuthenticationDetails1 = validateAuthenticationDetails("prasunay","prasun");
    System.out.println("<<======= WRONG values:" + validateAuthenticationDetails1);
    System.out.print("done!"); }
    public static boolean insert(String username,String password,SecretKey key) throws Exception {
    // mysql> CREATE TABLE myusers (user_name VARCHAR(20), pass_word VARCHAR(20), my_key BLOB);
    // Query OK, 0 rows affected (0.03 sec)
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost/users?user=root&password=");
    PreparedStatement ps = con.prepareStatement("INSERT INTO myusers VALUES (?, ?, ?)");
    ps.setString(1,username);
    byte[] encryptionBytes = encrypt(password, key);
    ps.setString(2, new String(encryptionBytes));
    ByteArrayInputStream ois = getStreamFromKey(key);
    byte[] keyBytes = getBytesFromKey(key);
    System.out.println("Key Length" + keyBytes.length);
    ps.setBinaryStream(3, ois, keyBytes.length);
    int result = ps.executeUpdate();
    System.out.println(result);
    ps.close();
    con.close();
    if (result > 0) {
    return true;
    } else {
    return false; } }

    code continuation.......
    public static boolean validateAuthenticationDetails(String username, String password) throws Exception {
    boolean result = false;
    // mysql> CREATE TABLE myusers (user_name VARCHAR(20), pass_word VARCHAR(20), my_key BLOB);
    // Query OK, 0 rows affected (0.03 sec)
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost/users?user=root&password=");
    PreparedStatement ps = con.prepareStatement("select my_key,pass_word from myusers where user_name = ?");
    ps.setString(1, username);
    ResultSet resultSet = ps.executeQuery();
    if (resultSet.next()) {
    String passwordFromDB = resultSet.getString("pass_word");
    Blob keyBlob = resultSet.getBlob("my_key");
    System.out.println(keyBlob);
    System.out.println("key" + resultSet.getBinaryStream("my_key").read());
    InputStream keyInputBinaryStream = keyBlob.getBinaryStream();
    System.out.println("keyInputBinaryStream: " + keyInputBinaryStream);
    System.out.println("keyInputBinaryStream: " + keyInputBinaryStream.available());
    ObjectInputStream ois = new ObjectInputStream(keyInputBinaryStream);
    SecretKey key = (SecretKey) ois.readObject();
    System.out.println(key);
    String decryptedPwd = decrypt(passwordFromDB.getBytes(), key);
    System.out.println("Decrypted pwd : " + decryptedPwd);
    System.out.println("pwd sent for authorization : " + password);
    if (password.equals(decryptedPwd)) {
    result = true;
    } else {result = false;   }
    } else {
    System.out.println("Invalid user!!"); }
    ps.close();
    con.close();
    return result; }
    public static ByteArrayInputStream getStreamFromKey(SecretKey key) throws Exception {
    ByteArrayOutputStream o = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(o);
    out.writeObject(key);
    byte[] keyBytes = o.toByteArray();
    ByteArrayInputStream bis = new ByteArrayInputStream(keyBytes);
    return bis;}
    public static byte[] getBytesFromKey(SecretKey key) throws Exception {
    ByteArrayOutputStream o = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(o);
    out.writeObject(key);
    byte[] keyBytes = o.toByteArray();
    return keyBytes; } }
    but it is giving following run-time error: Key Length263
    1
    <<======= insert result: true
    com.mysql.jdbc.Blob@1ea0252
    key172
    keyInputBinaryStream: java.io.ByteArrayInputStream@3e89c3
    keyInputBinaryStream: 263
    javax.crypto.spec.SecretKeySpec@fffe7a51
    Exception in thread "main" javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher
    plzz suggest some solution...

  • I created my database, and lost the URL

    XP pro, Oracle 10G
    Are there any tables v$
    that know the URL ??
    I know how to find the URL using the O/S,
    I would like to know of any other way to find it ?
    Thanks

    Did you look in $ORACLE_HOME/install/portlist.ini and $ORACLE_HOME/install/readme.txt? That should give you the port numbers and URLs for a 10g install.
    Alison

Maybe you are looking for