Problem in getting the database connection from a connection pool

Hai All,
I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
I am using the Oracle database 8.1.7.
I have configured my connection pool, datasource and JNDI in weblogic.
In my java program i have the following code to retrieve the connection.
import java.sql.*;    
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
class jdbcshp1 {
    public static void main(String[] args) {
     Connection connection = null;
     try {
           Hashtable ht = new Hashtable();
           ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
           ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
           // Get a context for the JNDI look up
           Context ctx = new InitialContext(ht);
        javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
          //Create a connection object
          connection = ds.getConnection();
     The above code is working fine but, the two ht.put statements are creating problem.
The problem is, after converting the application into WAR file it can be deployed
on any machine or different port on same machine. My application fails if its deployed on
weglogicserver which is at different port.
Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
any help is appreciated.
Thanks in advance
Pooja.

Hai All,
Firstly, thanks for ur reply.
Even i have seen some code which uses context constructor with out any parameter and works fine.
i dont understand why its not working for my code.
When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
connection = ds.getConnection();The error is as follows:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
I appreciate all ur valuable help.
Thanks once again.
Pooja.

Similar Messages

  • How to get the Database type from weblogic Db connection

    I want to use database version control in my application . that means different database type use different Sql Statement. Such as in weblogic7.0 if I create SqlServer JDBC pool then I will use some special Sqlserver sql Statement . such as some join statement. If I create Oralce JDBC pool then I have to use different Sql statement . because these two database support different Sql statement.
    What my question is how to get the database type from the connection.

    For a normal jdbc driver you can use
    Connection.getMetaData()
    To get the meta data, in particular the getDatabase...() methods.
    That might or might not work.
    However, at the very least in the server you have access to the weblogic properties so you can parse the pool property to figure it out.

  • Function module to get the database overview from DB02 Transaction

    Hi,
    I want to display the overview details from the transaction DB02. Is there any function module or any other method to do it. please help me.
    I have tried DB02_DB4_GET_INFO this function module but it is giving me only zeros but not any values. Please help me.
    Thanks,
    Sandeep.

    Hi
    It again depends on what is your DB server. As there are separate calls based on MSSQL, Oracle etc.
    For MSSQL use the FM's
    SMSS_GET_CONNECTION
    MSS_GET_DBSZHIST
    For Oracle use the FM's
    DB_ORA_TABLESPACE_HISTORY
    Regards
    Ranganath

  • Error while applying a patch "Unable to get the database connection"

    Dear Experts,
    A patch which got successfully applied is failing Production and the error is kind of surprising to me.
    Apps version is 11.5.10.2
    db version is 10.2.0.4
    The worker log file shows
    Time when worker restarted job: Thu Nov 24 2011 22:14:52
    Start time for file is: Thu Nov 24 2011 22:14:52
    adjava -ms128m -mx256m -nojit oracle.apps.fnd.odf2.FndXdfCmp &un_apps &pw_apps &un_apps &pw_apps &jdbc_protocol &jdbc_db_addr table &fullpath_pa_patch/115
    Reading product information from file...
    Reading language and territory information from file...
    Reading language information from applUS.txt ...
      Temporarily resetting CLASSPATH to:
      "/erp/oracle/prodappl/ad/11.5.0/java/adjri.zip:/usr/java14/jre/lib/charsets.jar:/usr/java14/jre/lib/core.jar:/usr/java14/jre/lib/graphics.jar:/usr/java1
      Calling /usr/java14/bin/java ...
    Exception occured
                  Copyright (c) 2003 Oracle Corporation
                     Redwood Shores, California, USA
             XDF(XML Object Description File) Comparison Utility
                            Version 1
    NOTE: You may not use this utility for custom development
          unless you have written permission from Oracle Corporation.
    Unable to get the database connection using schema username/passwordIo exception: The Network Adapter could not establish the connection
    AD Run Java Command is complete.
                         Copyright (c) 2002 Oracle Corporation
                            Redwood Shores, California, USA
                                        AD Java
                                     Version 11.5.0
    NOTE: You may not use this utility for custom development
          unless you have written permission from Oracle Corporation.
    AD Worker error:
    The above program failed.  See the error messages listed
    above, if any, or see the log and output files for the program.
    Time when worker failed: Thu Nov 24 2011 22:14:53
    {code}
    The error says database connection error.  I am able to connect to the database using sqlplus.  I tried to restart the failed worker, but the same error is repeating. 
    Any help would be appreciated.
    Thanks
    qARS
    Edited by: user7640966 on Nov 24, 2011 9:07 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hussein,
    One thing which I noticed now is in the apps Tier the
    tnsnames.ora under $TNS_ADMIN
    shows entry like this:
    PROD=
            (DESCRIPTION=
                    (ADDRESS=(PROTOCOL=tcp)(HOST=<appsServerName>)(PORT=1521))
                    (ADDRESS=(PROTOCOL=tcp)(HOST=<dbServer>)(PORT=1521))
                (CONNECT_DATA=
                    (SID=PROD)
            )Actually *(ADDRESS=(PROTOCOL=tcp)(HOST=<appsIPaddress>)(PORT=1521))* this line in the tnsnames.ora is not correct. In fact the appsServerName should be replaced with dbServerName
    I deleted the tnsnames.ora and reran autoconfig but it is again recreating the same entry.
    Any clue how this can be fixed?
    Thanks
    qARS

  • Problem in getting the function template object from the repository.

    Hi all,
    I have created a par file. I have a JCO connection in that. I am facing problems in getting the function template object from the repository. This thing is running successfully when i try to deploy it in Tomcat. But i am facing problems when i try to deploy it in SAP EP 6.0.
    Below is statement which is giving error after being deployed to SAP EP6.
    This is executing fine when executed in Tomcat Server.
    // getting the object of function template
    IFunctionTemplate functionTemplate =
    aRepository.getFunctionTemplate("YADDNEWUSER");
    Note : YADDNEWUSER is the name of the RFC which I am calling from my JAVA Code.
    Thanks in advance,
    Divija

    This sounds like a bug in the smart upload code. I have used this stuff before, but it's probably an older version, so maybe they broke something. Enumerations aren't usually guaranteed to keep things in any particular order. I would say for now, make a method to take the enumeration and a param name to find the value. And write to the JSPSmart people.

  • How to get the selection parameters from logical database into one of the t

    Hi Sap ABAP Champians,
    How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
    Please help me for this
    Thanks
    Basu

    Hi
    Thanks, that will work, but then I'll have to insert code into all my reports.
    I can see that "Application Server Control Console" is able to rerun a report.
    This must mean that the Report Server has access to the runtime parameters.
    But how?
    Cheers
    Nils Peter

  • How to get Database name/IP address of the database server from forms10g

    Hi everybody,
    How do I get the database instance name and IP address of the database server?
    I am using Foms 10g and the database server is Oracle 10g.
    Sukanta

    Dear...........
    Plz use this code
    select SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) ipaddr from dual;
    SELECT utl_inaddr.get_host_address IP ,UTL_INADDR.get_host_name NAME FROM dual;
    select SYS_CONTEXT('USERENV', 'HOST') HELLO from dual;
    select SYS_CONTEXT('USERENV', 'TERMINAL') HELLO from dual;
    select SYS_CONTEXT('USERENV', 'OS_USER') HELLO from dual;
    SELECT SYS_CONTEXT ('USERENV', 'SESSION_USER') FROM DUAL;
    SELECT SYS_CONTEXT ('USERENV', 'DB_UNIQUE_NAME') FROM DUAL;
    thx.

  • How could I get the Finish10 value from MS Project2010 Server_Reporting database

    I am trying to get the finish10 data from project server using SQL.
    But it seems the finish10 column is not in MSP_EpmAssignment_Userview or MSP_EpmTask_Userview.
    So could you please help me to find it?
    Thanks.

    Hi,
    try to extract information from MSP_EpmTaskBaseline.
    This is Sql query
    SELECT MSP_EpmTask_UserView.TaskName, MSP_EpmTaskBaseline.TaskBaselineFinishDate, MSP_EpmTaskBaseline.TaskBaselineStartDate,
    MSP_EpmTaskBaseline.BaselineNumber
    FROM MSP_EpmTaskBaseline INNER JOIN
    MSP_EpmTask_UserView ON MSP_EpmTaskBaseline.TaskUID = MSP_EpmTask_UserView.TaskUID
    WHERE (MSP_EpmTaskBaseline.BaselineNumber = 10)
    if doesn't work try to rebuild your reporting database.
    Hope this help you.
    Jalal Blali MCTS, MCITP
    Thanks for the help, but I'm trying to extract columns named [finish10], not [baseline1 ~10 finish].

  • Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    i have on my ipad2 and re-download it - but I can't afford to loose the presentation that I currently have ....??
    Are you using Keynote on an iPad?
    If so you posted in the wrong forum, this is the Keynote Mac discussion and it is a different application. I dont know how the iPad works at all, so I cant help you, post in the Keynote iOS discussion.
    If you are using a Mac, the colours palette is accesed by clicking on the colour well (arrowed) and then selecting a colour chip or changing the color in the colour wheel.

  • Facing problem while changing the database at runtime

    hi everyone,
    Before posting this thread, i have gone through the various posts addressing the problem....but still iam unable to get the solution for this problem.
    The report has been generated in one system, so the database properties (connection string....) are hardcoded in the report file...
    Now when iam trying to change the database, it is still connecting to the system where the report file was created.
    I have tried the changeDatasource() method, but it didnot worked....
    here is the code for changeDatasource() method
    public static void changeDataSource(ReportClientDocument clientDoc,
                    String reportName, String tableName,
                    String username, String password, String connectionURL,
                    String driverName,String jndiName) throws ReportSDKException {
            PropertyBag propertyBag = null;
            IConnectionInfo connectionInfo = null;
            ITable origTable = null;
            ITable newTable = null;
            // Declare variables to hold ConnectionInfo values.
            // Below is the list of values required to switch to use a JDBC/JNDI
            // connection
            String TRUSTED_CONNECTION = "false";
            String SERVER_TYPE = "JDBC (JNDI)";
            String USE_JDBC = "true";
            String DATABASE_DLL = "crdb_jdbc.dll";
            String JNDI_DATASOURCE_NAME = jndiName;
            String CONNECTION_URL = connectionURL;
            String DATABASE_CLASS_NAME = driverName;
            // The next few parameters are optional parameters which you may want to
            // uncomment
            // You may wish to adjust the arguments of the method to pass these
            // values in if necessary
            // String TABLE_NAME_QUALIFIER = "new_table_name";
            // String SERVER_NAME = "new_server_name";
            // String CONNECTION_STRING = "new_connection_string";
            // String DATABASE_NAME = "new_database_name";
            // String URI = "new_URI";
            // Declare variables to hold database User Name and Password values
            String DB_USER_NAME = username;
            String DB_PASSWORD = password;
            System.out.println("DB_USER_NAME......."+DB_USER_NAME);
            System.out.println("DB_PASSWORD......."+DB_USER_NAME);
            // Obtain collection of tables from this database controller
            if (reportName == null || reportName.equals("")) {
                Tables tables = clientDoc.getDatabaseController().getDatabase().getTables();
                System.out.println("Tables in reports........"+tables.size());
                for(int i = 0;i < tables.size();i++){
                    origTable = tables.getTable(i);
                    System.out.println("origTable........"+origTable.getQualifiedName());
                    if (tableName == null || origTable.getName().equals(tableName)) {
                        newTable = (ITable)origTable.clone(true);
                        // We set the Fully qualified name to the Table Alias to keep the
                        // method generic
                        // This workflow may not work in all scenarios and should likely be
                        // customized to work
                        // in the developer's specific situation. The end result of this
                        // statement will be to strip
                        // the existing table of it's db specific identifiers. For example
                        // Xtreme.dbo.Customer becomes just Customer
                        newTable.setQualifiedName(origTable.getQualifiedName());
                        System.out.println("newTable........"+newTable.getQualifiedName());
                        // Change properties that are different from the original datasource
                        // For example, if the table name has changed you will be required
                        // to change it during this routine
                        // table.setQualifiedName(TABLE_NAME_QUALIFIER);
                        // Change connection information properties
                        connectionInfo = newTable.getConnectionInfo();
                        // Set new table connection property attributes
                        propertyBag = new PropertyBag();
                        // Overwrite any existing properties with updated values
                        //propertyBag.put("Trusted_Connection", TRUSTED_CONNECTION);
                        //propertyBag.put("Server Type", SERVER_TYPE);
                        propertyBag.put("Use JDBC", USE_JDBC);
                        propertyBag.put("Database DLL",DATABASE_DLL );
                        propertyBag.put("JNDI Datasource Name",JNDI_DATASOURCE_NAME );
                        propertyBag.put("Connection URL", CONNECTION_URL);
                        propertyBag.put("Database Class Name", DATABASE_CLASS_NAME);
                        //propertyBag.put("Server Name", SERVER_NAME); //Optional property
                        // propertyBag.put("Connection String", CONNECTION_STRING); //Optional property
                        // propertyBag.put("URI", URI); //Optional property
                        connectionInfo.setAttributes(propertyBag);
                        // Set database username and password
                        // NOTE: Even if the username and password properties do not change
                        // when switching databases, the
                        // database password is *not* saved in the report and must be set at
                        // runtime if the database is secured.
                        connectionInfo.setKind(ConnectionInfoKind.SQL);
                        connectionInfo.setUserName(DB_USER_NAME);
                        connectionInfo.setPassword(DB_PASSWORD);
                        // Update the table information
                        clientDoc.getDatabaseController().setTableLocation(origTable,newTable);
    Also i tried with replaceConnection() method...........it displayed the report, but with not column names and data
    need help regarding.......
    Edited by: abhishek.c1984 on Jun 25, 2009 10:02 AM

    In the report i have two tables.............so before changing the database properties for each table iam printing their names.
    The names are dispalyed correctly.......but once i set the table location...i.e through the following method..
    clientDoc.getDatabaseController().setTableLocation(tables.getTable(i),newTable);
    every time i can see only one table i.e. properties are set for the first table ........and each time the properties are being set for the first table only.....i dont no what is happening to the rest of the tables..
    I have posted the method in the above post.....can any one please trace out the problem
    Note: when i comment the following code, i can see all the tables
    clientDoc.getDatabaseController().setTableLocation(tables.getTable(i),newTable);
    when i uncomment it, i can see only first table repeating every time...
    Edited by: abhishek.c1984 on Jun 25, 2009 1:03 PM

  • How to get the SSO user from PL/SQL with Windows native authen

    I connect to a 10g daabase using SSO through Windows Native Authentication wher the OID user mapps to a single Database user.
    I need to get the SSO user from pl/sql
    My fornt end is Portal & Forms

    Hmm, I see.
    Well your problem boils down to being in the database and needing to have access to web environment variables. The SSO sets specific variables in the environment but your stored procedure is not privy to them.
    Now having said that, note that the mod_plsql Web Toolkit has a utility for accessing cgi variables. For instance,
    owa_util.get_cgi_env('Osso-User-Dn')
    If your web application cannot capture the SSO info and pass it to the stored proc in a parameter, OWA may be the only way.
    Check out the Single Sign-On Developers Guide, specifically the part about developing statically protected PLSQL applications.
    Hope this helps.
    regards,
    tt

  • Please!!! The database link contains invalid connection information

    Hi,
    I recently set up OWB 9.04 on a 9.0.1 database,window2000. I am getting an error when I try to create a database module.it throws the following error:
    API4006:The database link contains invalid connection information.API2414: Cannot determine version information to the specified database link. Check the database link and try again.
    I tried manully using sql/plus to create dbLink,same problem.
    thanks ,I need your help!

    Hello,Mark
    I tried the query at local database.It seems ok,as following:(connect as owb user and dba_granted user indivisually)
    SQL> select SID,USER# from v$session;
    SID USER#
    1 0
    2 0
    3 0
    4 0
    5 0
    6 0
    7 72
    8 72
    9 72
    11 67
    10 rows selected.
    SQL> desc v$version;
    Name Null? Type
    BANNER VARCHAR2(64)
    SQL> select * from v$version@FM2;
    BANNER
    Personal Oracle9i Release 9.0.1.1.1 - Production
    PL/SQL Release 9.0.1.1.1 - Production
    CORE 9.0.1.1.1 Production
    TNS for 32-bit Windows: Version 9.0.1.1.0 - Production
    NLSRTL Version 9.0.1.1.1 - Production
    it still can't forward to next step!
    please give me further help!

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • Is there a way to get the correct order from the dependent types of a sche

    Hi ,
    I have a CT facing the following problem:
    When trying to built a SQL script to create all the object types within a schema using the DBMS_METADATA packages.
    Did insert in a table the names of the types that will be exported following a concrete order, next loop into the table and call the DBMS_METADATA package for each row.
    These type are depedent between them, there are some type attributes calling other types and here the issue
    First : try to generate the order by created column of dba_objects and when the generated SQL script is launched a lot of type appearing as incomplete state due to the order isn't correct.
    Second : try to insert the table ordering by object_id colums of dba_tables view, it appears incomplete types too.
    Currently want to insert the table using a recursive query with connect by against the dba_type_attrs starting with the rows when ATTR_TYPE_NAME is not null (the types that are called by other types), but this way has a issue dificult to resolve: the roots of hierarchy are the rows when ATTR_TYPE_NAME is not null and we've dependencies between roots nodes
    The question is is there a way to get the correct order from the dependent types of a schema?
    Platform: IBM SP AIX
    DB version: 9.2.0.7
    Any help will be appreciated .
    Thanks in advance.

    The xxx_dependencies view should give you the dependencies betwee nthe various types. I would look at something along the lines of:
    SELECT object_name, referenced_name
    FROM (SELECT o.object_name, d.referenced_name
          FROM user_objects o, user_dependencies d
          WHERE o.object_name = d.name(+) and
                o.object_type = d.type(+) and
                d.referenced_type(+) = 'TYPE' and
                o.object_type = 'TYPE')
    START WITH referenced_name IS NULL
    CONNECT BY PRIOR object_name = referenced_nameThe outer join between user_objects and user_dependencies is required to generate the names of types which are not dependent on other types, or do not have other types dependent on them.
    HTH
    John

  • Iphone 4s coming friday, what is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across.

    What is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across. If I do a restore as I have when previously from one iphone to another it has shown (in settings, usage) the cumulative usage from previous phones so all the hours of calls on all previous iphones will be displayed even though its brand new. Anyone know how I can get my notes (from standard iphone notes app) to my new iphone 4s without restoring from previous iphone 4. Thanks for any help offered.

    First, if you haven't updated to iTunes 10.5, please update now as you will need it for the iPhone 4S and iOS 5.
    Once you're done installing iTunes 10.5, open it. Connect your iPhone to iTunes using the USB cable. Once your iPhone pops up right click on it. For example: an iPhone will appear and it will say "Ryan's iPhone."
    Right click on it and select "Backup" from the dropdown menu. It will start backing up. This should backup your notes.
    Please tell me if you have any problems with backing up.
    Once you backup and get your iPhone 4S, you must follow these steps. If you don't follow these steps, you will not be able to get your notes on your new iPhone 4S.
    Open up iTunes again then right click on your device (iPhone 4S). Once you do you will see a dropdown menu. It will say "Restore from Backup..." Select this and it'll ask for a backup, select it from the dropdown menu. For example "Ryan's iPhone - October 12, 2011." Pick that and it will restore to your backup. Do this when you get your iPhone 4S so you will not lose anything. Even though you're restoring, you're getting back, since you're getting the previous settings, notes, contacts, mail and other settings from your old iPhone. You'll still have Siri though! So, restore when you first get it. Also frequently backup your device, as it will be worth it. You can restore from a backup if something goes wrong or save your data for a future update.
    Once you do that, you should have your notes on your new iPhone 4S and iOS 5.
    Please tell me if you need any help.
    I hoped I answered your questions and solved your problem!

Maybe you are looking for

  • Sony HDR-HC1 import fix

    I have a G5 tower (dual 2ghz) and had difficulty importing to iMovie 6 from my Sony HDR-HC1. Like many folks have identified in other posts, I could get iMovie to recogognize the camera and operate the transport but could not import any video or audi

  • Difference between US eliminations and "normal" intercompany eliminations?

    Hi, Can a kind soul please explain the differences between intercompany eliminations and US eliminations please? Thanks

  • Hanging program; please help

    import cs1.Keyboard; public class Lab3Prog2Stage3 {    public static void main(String[] args) {       final int PENNY_VALUE = 1;       final int NICKEL_VALUE = 5;       final int DIME_VALUE = 10;       final int QUARTER_VALUE = 25;       int penniesA

  • Copy Folder Structure from Explorer into Outlook 2013

    Hi, I have just spent approx 3 months designing an Enterprise Classification Scheme, and built a folder structure in Explorer that I want to replicate in Outlook. I thought it would have been as simple as copy and pasting from Explorer to an Outlook

  • HT201210 I have Ipad modal A1337 why wont it update to IOS 7

    Why cant I update it To IOS 7 I have Ipad A1337 and Its shows I can but says when i try its latest version why