How to execute Oracle "CONNECT BY" using JPA or Hibernate annotation?

hihi
I want to uses ORACLE "CONNECT BY" to obtain each level of tree structure, like:
A
|-B
--|-D
|-C
--|-E
The result should be: A = 1 and B,C = 2 and D,E = 3
Do I have any hibernate or JPA annotation to do this?
Thanks.

Thank you for your reply,r035198x .
but when I using native query, the program throws the NullPointerException, how can I solve this problem. (the query object is NOT NULL)
Query query = entityManager.createNativeQuery("SELECT group.*,level FROM GROUP group "+
                     "WHERE GROUP_TYPE = 'ACTIVE' START WITH (PARENT_GROUP_ID IS NULL) "+
                     "CONNECT BY PARENT_GROUP_ID = PRIOR GROUP_ID",GROUP.class);
log4jLogger.info("query: "+query);
List<GROUP> groups = query.getResultList();
Result:
INFO [http-8080-2] service.GroupAction (getGroups:36) - query: org.hibernate.ejb.QueryImpl@1a5db9c
Caused by: java.lang.NullPointerException
    at org.hibernate.loader.DefaultEntityAliases.intern(DefaultEntityAliases.java:157)
    at org.hibernate.loader.DefaultEntityAliases.getSuffixedPropertyAliases(DefaultEntityAliases.java:130)
    at org.hibernate.loader.DefaultEntityAliases.<init>(DefaultEntityAliases.java:76)
    at org.hibernate.loader.ColumnEntityAliases.<init>(ColumnEntityAliases.java:40)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:152)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:67)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:136)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:160)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
at test.GroupAction.getGroups(GroupAction.java:38)

Similar Messages

  • How to execute oracle stored procedure through php as externally?

    hi...
    i am searching for the way that how to execute oracle stored procedure through web service, i am using php and mysql, i have some stored procedures in oracale database, i want to execute them, from php, means the database will be remain mysql, and the stored procedures of oracle will be executed externally...
    Kind regards,
    Wilayat.

    Ok, so first of all this is a kind of strange question. Since Oracle and MYSQL can happily live side by side.
    Make sure you have the oracle client (instant or regular ) installed and OCI_8 is set up and working correctly in PHP. If it is, when you run the phpinfo() routine you will see oci_8 on there. IF PHP connects just fine from the command line yet apache wont connect check permissions and things like the LD_Library Path.
    Then in php, right along with your MySQL statements run Oracle Statements eg:
    <?php
    $OraDB = oci_connect(name,pass,tnsname);
    $MySQLdb = mysql_connect([parms]);
    $oraQueryText = "begin sp_some_proc([some parms]); end;" ;
    $mysqlQuery = " Some mysql Query";
    $oraQuery = oci_parse($OraDB,$oraQueryText );
    oci_execute($oraQuery);
    mysql_execute([parms]);
    ?>
    Use the standard fetch code to get data from either of them.
    If you cannot and I mean absolutely cannot get an admin to link in OCI_8 then you still have recourse although it will be tedious as hell. PHP allows you to exec calls to the OS. You still MUST make sure the Oracle Client is installed and that sqlplus runs from the command line. You will more then likely have to have a shell script written to do this as well, but maybe not as I have never tried it with the exception of capturing the return value of sqlplus and you will have to dig into sqlplus to get it to send its results to a file you can then parse with php.
    Good Luck!

  • How to execute a exe file using javascript on app window.load.

    How to execute a exe file using javascript on app window.load.

    Hi sb00349044,
    As I have already mentioned in multiple replies to your previous questions, the SUMO forums focuses on providing help to end users with usage-questions and issues.
    For developer-related questions, please refer to one of the many resources readily available that I have linked to in the past:
    * [https://developer.mozilla.org/en-US/Firefox_OS MDN]
    * [http://stackoverflow.com/questions/tagged/firefox-os StackOverflow]
    * [https://lists.mozilla.org/listinfo Mozilla Mailing Lists]
    - Ralph

  • How to execute oracle reports file from jsp using WL as an app server

    I plan to use jsp to accept IN parameters and later want to execute oracle
              report execute stored in some directory and provide results back to the
              client browser window. Is this possible in JSP + WL? If yes, can you
              provide some tips on the code?
              Thanks.
              

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • How to execute a stored procedure using Nqcmd

    hi everyone,
    I am having a stored procedure in Database which i want to execute it from nqcmd. Could anyone pls let me know how to execute it.
    Regards

    EJB3 JPA does not define stored procedure execution. There is a native query in JPA, but this is mainly for SQL. If you stored procedure has no output parameters you can normally get away with using a native query to execute it (be sure to include BEGIN/END in Oracle).
    <p>
    In TopLink 11g preview there are JPA extensions for defining stored procedures. You can use the @NamedStoredProcedureQuery for this, and then access the named query by name and execute it. You can also create an instance of a TopLink StoredProcedureCall and set it in your JPA Query through the TopLink Query extension setDatabaseQuery(), or define the named stored procedure query using a DescriptorCustomizer.
    <p>
    In TopLink Essentials there is no direct stored procedure support, so you would need to use JDBC directly.
    <p>
    If you are using a DataSource in your application the best way to get a JDBC connection is to use your DataSource directly. If the DataSource is JTA managed this will be the same connection that TopLink writes with.
    <p>
    If you need to get the connection directly from TopLink you can use,
    ((oracle.toplink.<essentials>.ejb.cmp3.EntityManager)entityManager.getDelegate()).getUnitOfWork().getConnection();
    <p>
    You may need to first call, UnitOfWork.beginEarlyTransaction(), (also ensure you release the uow connection).
    <p>
    <p>---
    <p>James Sutherland

  • How to Execute Remote procedures that use DBLinks?

    Using Oracle 10g (RAC Linux) to remote connect Windows 10g to dblink to AS/400 <
    <I have created a procedure that I execute remotely by issuing the following:
    CALL GLOBAL.REFRESH_STAGING@KRONOSLINK();
    The procedure errors as
    Error at line 2
    ORA-20001: ERROR OCCURED
    ORA-06512: at "GLOBAL.REFRESH_STAGING", line 47
    ORA-06512: at line 1
    The procedure runs without error from the host database. The problem is when the procedure makes a call to the dblink.
    I unsuccessfully attempted to capture the error message.
    Question: Is it possible to execute remote procedures that use dblinks? If so, How is that accomplished.
    Question: What is the proper way to handle exceptions in this case?
    Bonus: What can be done to improve this procedure? (Suggestions, like adding return on the procedure).
    CREATE OR REPLACE PROCEDURE GLOBAL.REFRESH_STAGING IS
    NOOBJECT EXCEPTION;
    OBJECTEXIST EXCEPTION;
    PRAGMA EXCEPTION_INIT(NOOBJECT, -00942); -- Exception handling for ORA-00942 - table or view does not exist
    PRAGMA EXCEPTION_INIT(OBJECTEXIST, -00955); -- Exception handling for ORA-009555 - name is already used by an existing object
    sT LONG := '';
    sS LONG := '';
    sST LONG := '';
    cursor csrO is
    SELECT
    SCHEMANAME,
    TABLENAME
    FROM GLOBAL.STAGING_TABLES;
    csrR csrO%ROWTYPE;
    BEGIN
    FOR csrR IN csrO
    LOOP
    sT := csrR.TABLENAME;
    sS := csrR.SCHEMANAME;
    sST := sS || '.' || sT;
    BEGIN
    EXECUTE IMMEDIATE 'drop table global.' || sT || ' purge';
    EXCEPTION
    WHEN NOOBJECT THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    BEGIN
    EXECUTE IMMEDIATE 'create table global.' || sT || ' nologging as select * from ' || sST || '@thebosslink';
    COMMIT;
    EXCEPTION
    WHEN OBJECTEXIST THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    DBMS_OUTPUT.PUT_LINE(SQLCODE || ' - ' || SQLERRM);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    END LOOP;
    END REFRESH_STAGING;
    Thanks,
    blevels

    SET LINESIZE 500;
    COLUMN DB_LINK FORMAT a20
    COLUMN HOST FORMAT a20
    COLUMN USERNAME FORMAT a20
    COLUMN OWNER FORMAT a10
    COLUMN TABLE_NAME FORMAT a20
    select db_link,username, host from all_db_links where db_link = 'KRONOSLINK';
    select privilege from dba_sys_privs where grantee = 'SYSTEM';
    select owner, table_name from dba_tab_privs where grantee='SYSTEM';
    DBLINK_ USERNAME HOST
    KRONOSLINK SYSTEM ORCL
    1 row selected.
    PRIVILEGE
    GLOBAL QUERY REWRITE
    CREATE MATERIALIZED VIEW
    CREATE TABLE
    UNLIMITED TABLESPACE
    SELECT ANY TABLE
    5 rows selected.
    OWNER TABLENAME_
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS DBMS_ALERT
    SYS DBMS_SYS_ERROR
    SYS DBMS_RULE_EXIMP
    SYS DBMS_AQ
    SYS DBMS_AQADM
    SYS DBMS_AQ_IMPORT_INTER
    NAL
    SYS DBMS_AQELM
    SYS DBMS_TRANSFORM_EXIMP
    SYS SYS_GROUP
    SYS DBMS_DEFER_IMPORT_IN
    TERNAL
    SYS DBMS_REPCAT
    WMSYS WM$UDTRIG_INFO
    SYS SET_TABLESPACE
    SYS CHECK_UPGRADE
    SYS AVINASH
    SYS AVINASH
    SYS AVINASH1
    SYS AVINASH1
    SYS DB_PMP
    SYS DB_PMP
    SYS DIR_TESTCASE
    SYS DIR_TESTCASE
    SYS EXPORT_FULL_DIR
    SYS EXPORT_FULL_DIR
    SYS PUMP
    SYS PUMP
    SYS LOGS
    SYS LOGS
    SYS DPUMP_DIR2
    SYS DPUMP_DIR2
    SYS AVIS
    SYS AVIS
    SYS DPDIR_LCLLGS
    SYS DPDIR_LCLLGS
    67 rows selected.
    Edited by: user10860953 on Jan 28, 2010 10:43 AM

  • How to execute  the CONNECT command in sql

    Hi ,
    I am using DB2 database and I need to execute the sql statement
    CONNECT TO Database user username USING password.
    Can anyone tell me how to execute this query in java.
    I tried this by using executeQuery but it was giving a sexception somtehing as follows
    COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0637E QUERY cannot be found.
         at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throwInvalidQueryError(SQLExceptionGenerator.java:577)
         at COM.ibm.db2.jdbc.app.DB2Statement.executeQuery(DB2Statement.java:597)
         at First.detail(First.java:18)
         at First.main(First.java:29)
    can anyone of you help me out in solving this problem

    You need a connection to use JDBC stuff. When you have a connection, you are already logged in. There is no need for a query to connect.

  • How to install oracle connection manager on solaris 10

    I have installed oracle application server 10.1.2 on solaris 10. How do i install oracle connection manager utility.
    My end goal is to use applets/jdbc.
    Thanks

    Thank you Zettabyte!!
    Folks, network printers should NOT BE configured like this:
    lpadmin -p somequeue -s someprinter
    that creates a remote style queue and puts all the I/O and processing capability on the basic LPD listener present on network printer interfaces. This will cause problems down the road, not to mention that you cannot control access, get any logging, filter content, or control banner pages.
    Network printers should use any software (or PPD file) supplied by the vendor over the basic lpadmin/netstandard config.
    You can install CUPS, but Oracle won't support it until it's part of the OS (S11, apparently).
    The "System Administration Guide: Solaris Printing" is highly recommended for those administering printers on Solaris.

  • How to configure oracle alerts to use Workflow mailer?

    Hello Guys:
    We were trying to setup oracle alerts using workflow mailer. I have created a dedicated mailer for handling oracle alerts related mail.
    Here is what I need to clarify:
    1. Having setup a new mailer for Oracle alert do I have to still configure the Options in Oracle Alerts. This is where you choose which type of mail u want to use ( like Unix mail,Windows NT mail )
    2.How do I tell oracle alert to use the new mailer that I created exclusively for this? While creating the mailer at some point I remember putting ALR in configuration form.
    I am on 11.5.10 CU2. I am on 11i.ATG_PF.H
    Regards,
    Bala

    Hi Hussain:
    Based on the note I realised that my oracle alerts will user unix sendmail. But then If u go to " Oracle Alert Options "
    -- > Mail systems -- I check Unix send mail
    -- > Mail server options ( Do I have to fill this section? )
    My guess is that the send mail will post the email to a IMAP account ( I created oraclealert account ) and IMAP account will push the alert email to Recipient
    Mail Database/Server Name --- imap.mydomain.com
    Mail Priority --- Normal
    Accounts
    Application Installation username Password
    Blank ** Blank ** oraclealert pwd
    Blank ** Blank ** oraclealert pwd
    ** - It wont allow me to choose an application.
    Is there a simple test to make sure that my oracle alert is working or not? I appreciate your help.
    Regards,
    Bala

  • How to configure Oracle 10g to use 4GB memory

    I'm trying to configure Oracle 10g to use >4GB memory. Have configured server boot.ini with required flags (/3GB /PAE). Rebooted server then created standard database, then connected to db instance and changed oracle parameters DB_BLOCK_BUFFERS, USE_INDIRECT_DATA_BUFFERS as required. Restarted DB instance, DB fails to restarted with SGA memory error. According to oracle user docs the SGA is nolonger in effect due to previous settings. Can you provide example of SPFILE with parameters settings that do work and use >4GB memory. Current server has 8GB, 2 x Dual XEON core/processors (i.e. 8 processors)

    The recommended /3GB switches in the boot.ini file can only be used with the following operating systems editions (KB article 291988):
    Microsoft Windows 2000 Advanced Server
    Microsoft Windows 2000 Data Center Server
    Microsoft Windows Server 2003, Enterprise Edition
    Microsoft Windows Server 2003, Data Center Edition
    Microsoft Windows Small Business Server 2003
    Important: Windows 2000 and 2003 Server Standard Editions DO NOT SUPPORT /3GB Switch.
    So if your OS is listed above, then you cannot have a larger SGA.

  • General question: How to execute a batch input using different user name?

    Hi everyone,
    I would be very grateful if someone could tell me how to execute a batch input from source code using a differente username so the batch input is executed with different permissions.
    For example, I log on with:
    Username: A
    , but I'd like to execute a batch input using the rights and permissions of user B.
    Thanks in advance and best regards.
    Ben.

    If you are calling the BDC in a program, create a job to run the program and specify the user you want each program to run under.

  • How many opened oracle connections?

    Hi Friends,
    I'm usnig Oracle 10g and TOAD 9 for my project. Here i want to know
    how many oracle connections are opened?
    Please give me a query to get currently opened connections?
    I did not get any specific TOAD forum to post this?
    could you please also tell me if there is a specific forum for TOAD?
    thanks

    user9058123 wrote:
    No,
    I want to know the connections
    for ex: If we are working with any Application server like weblogic,we can set initial connections to 10 and increment to 2. What it will do here is if all the 10 connections are either open or busy then weblogic will automatically add 2 more connections (what we set ).
    Here i'm requesting you that in TOAD also is there any requirement to know how many connectiosn are currently opened?
    You need to understand that
    1) TOAD is not an oracle product, so you will not find any direct support (such as forums) for Toad on an Oracle web site.
    2) TOAD does not bring any magic to an oracle database. Everything it shows you can be seen via standard sql statements. Thus, any help you receive here will be from the standpoint of those sql statements, not clicking some icon in Toad.
    I'm not sure whether Sessions and Connections are same?Have you checked the Concepts Manual, found at tahiti.oracle.com?
    >
    Friends please clarify it.
    regards,

  • How to have ethernet connected PC use printer and USB HD connected into TC

    So I just got a new Time Capsule (500GB) and the way I have it connected is the cable modem goes through it and then another ethernet cable connects to my desktop PC (no wireless on this PC). Then I have my USB printer and USB HD going into the USB port on the Time Capsule via a USB Hub. Airport utility sees both the HD and the Printer.
    My problem is that I can't get my PC to see the HD or the Printer. How does a PC connected through a ethernet cable and not wireless see and use these two peripherals? I have Bonjour for Windows installed but I thought that was for a wireless connection? Also is there a way to open some kind of configuration thing for Bonjour on my PC? Where on my PC would I find the HD and Printer (like in Windows Explorer or Network Places), I can't find these devices anywhere except when looking in the Airport Utility Manual Setup.
    Any help would be much appreciated. I don't have much technical knowledge about networks.
    Edit: One last thing is that before getting the TimeCapsule, I had a regular D-Link router running my wireless network and the printer was connected directly to the PC. This setup allowed my Macbook to use the printer and access any shared folders/files on my PC. My Mackbook was recently stolen and my new one will arrive next week, so right now I can't really test whether the Macbook can see and use the HD and Printer if they are connected to the Time Capsule. I'm wondering if I should just go back to plugging the HD and printer into the PC and running the network sharing that way????
    Message was edited by: arbitrage

    Just wanted to bump this question to see if anyone has any answers. My main issue is seeing the time capsule from my Windows desktop and the connected harddrive. However, my new problem is that whenever I connect the USB Windows Formated HD to the Time Capsule the whole thing just stops working and my PC and my MacBook can't read the Time Capsule at all until I turn of the USB HD. Any help would be appreciated.

  • How to execute a cvs command using System Call?

    hi all,
    how to execute a cvs login command using system call ?
    thanks,
    dam

    To anyone that reached this post and still dont have a hint, try this small sample - it logs on CVS using installed CVSNT and execute a fake update:
    package testeCVS;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    public class execCMD
        String password="yourPassword";
        String directory="C:\\CVS\\yourPathToProject";
        //send commands to CVS and shows the resulting screen
        public int sendCMD(String[] command) throws IOException, InterruptedException
            ProcessBuilder pb = new ProcessBuilder(command);
            pb.directory(new File(directory));
            pb.redirectErrorStream(true); // merge stdout and stderr
            Process p = pb.start();
            InputStreamReader isr = new  InputStreamReader(p.getInputStream());
            BufferedReader br = new BufferedReader(isr);
            String lineRead;
            StringBuilder buffer=new StringBuilder();
            System.out.println("Return of shell:");
            while ((lineRead = br.readLine()) != null)
                buffer.append(lineRead + "\n");
            System.out.println(buffer.toString());
            return p.waitFor();
        //send commands to CVS, send the password after the prompt and show the resulting screen
        public int sendDialogCMD(String[] command) throws IOException, InterruptedException
            ProcessBuilder pb = new ProcessBuilder(command);
            pb.directory(new File(directory));
            pb.redirectErrorStream(true); // merge stdout and stderr
            Process p = pb.start();
            PrintWriter writer = new PrintWriter( new OutputStreamWriter( p.getOutputStream() ));
            writer.println( password );
            writer.flush();
            InputStreamReader isr = new  InputStreamReader(p.getInputStream());
            BufferedReader br = new BufferedReader(isr);
            String lineRead;
            StringBuilder buffer=new StringBuilder();
            System.out.println("Return of shell:");
            while ((lineRead = br.readLine()) != null)
                buffer.append(lineRead + "\n");
            System.out.println(buffer.toString());
            return  p.waitFor();
        public static void main(String a[]) throws IOException, InterruptedException
            execCMD e=new execCMD();
            String[] command = new String[5];
            command[0] = "cvs";
            command[1] = "-q";
            command[2] = "-d";
            command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject"; //in this case using CVS port 2402
            command[4] = "login";
            System.out.println("exit value=" + e.sendDialogCMD(command));
            command = new String[8];
            command[0] = "cvs";
            command[1] = "-q";
            command[2] = "-d";
            command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject";
            command[4] = "-n";
            command[5] = "-q";
            command[6] = "update";
            command[7] = "-dA";
            System.out.println("exit value=" + e.sendCMD(command));
    }It is possible to send the password on the same command, but I had problems when the password had the character '@' because CVSNT took it as the separator between the username and server name. In that case the command is: ":pserver:yourUserID:yourPassword@localhost:2402/path/of/yourProject"

  • How to execute fast a report using an Oracle Repors6i?

    Hi guys,
    Im doing a report using an Oracle Reports6i, I encountered a problem regarding
    the TABLE. Everytime i run the report it takes 1 hour to display the report.
    The problem was the TABLE im using has a large volume of data. What im going to
    do with this TABLE with lots of data.
    Can anyone help me execute my report faster.
    Thank you.
    Lala

    user528488 wrote:
    Hi guys,
    Im doing a report using an Oracle Reports6i, I encountered a problem regarding
    the TABLE. Everytime i run the report it takes 1 hour to display the report.
    The problem was the TABLE im using has a large volume of data. What im going to
    do with this TABLE with lots of data.
    Can anyone help me execute my report faster.
    Thank you.
    LalaUse a very restrictive WHERE clause on "the TABLE".
    Or, undertake some performance tuning (utilizing the previously posted links to provide proper information).

Maybe you are looking for

  • I got my Macbook Air from a family member and I can't get my address book on my computer.  What do I do to get the address book on it?

    I purchased an Air Mac and can't get the address book on it.  Does anyone have any ideas on what I should do.  I have an IPhone and an IPad and they both have clouds but I don't see one on my Air Mac.

  • TO_DATE Function

    Hi, one DBA created web_type column as varchar2(35) instead of date datatype from dev to production. Now users have inserted data in to those columns where web_update is varchar2(35) datatype. The below code worked if the date date is inserted in var

  • How to add events to the Calendar on iPhone in iOS5

    I've got a 3Gs and upgraded to iOS 5 this morning. When I access my calendar on the iphone (iCal) I can't add any activities/events to a particular date (in month view). There used to be a + sign when you clicked a date, which is gone now. I tried ta

  • Crash after close the software

    I open the lightroom 4 and then I decided to create a new catalog, after go in the option "File" > "New catalog" the software closes and do not open anymore, then, i search the problem e find out that the software does not really close, it stay opene

  • Updating 5D Mark III firmware

    I am trying to update my 5D Mark III firmware.The download is on the CF card but the camera cannot read it. What have i done wrong?  I use an Apple iMac