Updating to connection object in JDeveloper

Dear all,
For my BC4J project, I have a connection by name CorrosionConnection. This connection is set with username=cer2265, password=cer2265,sid=cer, hostname=196.15.40.23,port=1521.
So for so good. Application is working fine and I can happily make any transaction.
This is my default setting. Suppose I have placed a text file as follows.
username: cer2265
password: cer2265
sid: cer
hostname: 196.15.49.23
port: 1521
Let us name this file as connection.txt. When ever application starts application should read this file and should update CorrosionConnection object with this information.
Now suppose If i need to change the ip address from 196.15.49.23 to 196.15.49.22 what I need to do is the following..
username: cer2265
password: cer2265
sid: cer
hostname: 196.15.49.22
port: 1521
Thus a type of dynamic connection object is now created, where I can even change the username, password , sid and port.
I don't know how to do this. Reading the file can be done by any filestream object. Updating the connection object is the problem.
Can any one help me in this regard,
Thanks in advance.

If you need your connection to be dynamic because of DHCP you could use "localhost" or "127.0.0.1" for your IP address if your database server is on same machine as application server.
Otherwise I would recomend reading BLOG from Steve:
http://radio.weblogs.com/0118231/2004/08/11.html
and Oracle documentation:
http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html
and Google :)

Similar Messages

  • Updating to connection object

    Dear all,
    For my BC4J project, I have a connection by name CorrosionConnection. This connection is set with username=cer2265, password=cer2265,sid=cer, hostname=196.15.40.23,port=1521.
    So for so good. Application is working fine and I can happily make any transaction.
    This is my default setting. Suppose I have placed a text file as follows.
    username: cer2265
    password: cer2265
    sid: cer
    hostname: 196.15.49.23
    port: 1521
    Let us name this file as connection.txt. When ever application starts application should read this file and should update CorrosionConnection object with this information.
    Now suppose If i need to change the ip address from 196.15.49.23 to 196.15.49.22 what I need to do is the following..
    username: cer2265
    password: cer2265
    sid: cer
    hostname: 196.15.49.22
    port: 1521
    Thus a type of dynamic connection object is now created, where I can even change the username, password , sid and port.
    I don't know how to do this. Reading the file can be done by any filestream object. Updating the connection object is the problem.
    Can any one help me in this regard,
    Thanks in advance.

    If you need your connection to be dynamic because of DHCP you could use "localhost" or "127.0.0.1" for your IP address if your database server is on same machine as application server.
    Otherwise I would recomend reading BLOG from Steve:
    http://radio.weblogs.com/0118231/2004/08/11.html
    and Oracle documentation:
    http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html
    and Google :)

  • Updating Connection Object Address

    Hi all,
    Is there any  FM/BPAI to update Connection object address.
    with regards,
    Sumanth

    Hi all,
    I am facing an issue while using the FM: ISU_S_CONNOBJ_CHANGE to update a connection object address in the following manner:
    CALL FUNCTION 'ISU_S_CONNOBJ_CHANGE'
          EXPORTING
            x_haus         = wa_conobj_update-tplnr
            X_UPD_ONLINE   = co_flagged
            x_no_dialog    = co_flagged
            x_auto         = lwa_address
            X_OBJ          = lwa_object
          IMPORTING
            y_db_update    = lwa_update
    I am filling the values in the structures: lwa_address-addr_data & lwa_object-addr1_data_new. (Just filling 6 fields: CITY1, POST_CODE1, HOUSE_NUM1, HOUSE_NUM2, STREET & COUNTRY).
    I am also using COMMIT WORK (at sy-subrc = 0). Still this FM is not updating the values.

  • Update  address details of connection object

    Hi,
    I need a FM/BAPI to update address details of connection object.
    I'm currently using ADDR_UPDATE and 'ADDR_MEMORY_SAVE'  I'm able to successfully update 9 address lines.
    But not the telephone and fax number.
    Hence I need a FM/BAPI to specifically update telephone and fax number of connection object.
    Please suggest.
    Thanks.
    Priyanka Ashtekar

    hi,
    refer ti this link...
    Updating Connection Object Address

  • Updating Connection object HOUSE_NUM1 in the system

    Hi,
    I need to update Connection object HOUSE_NUM1 IN THE SYSTEM.
    Can you suggest me  a function modjule fkor the same.
    The standard function module ISU_S_CONNOBJ_CHANGE says coding for no dialog will be included if required.
    Regards,
    Jyothsna

    Hi Jyothsna
    I was a little bit surprised as well to see this comment instead of the necessary code for background processing.
    However, it is not overly difficult to create your own function to do so (if you don't want to change the classification).
    First have a good look through ISU_S_CONNOBJ_CREATE and create the new function with following calls:
    ISU_O_CONNOBJ_OPEN
    Here you have to populate the structures ADRC_STRUC and EHAU
    ADDR_ACCEPT_REG_DATA_ERROR  (optional)
    ISU_CONNOBJ_CHECK
    ISU_O_CONNOBJ_PREPARE_CLOSE
    ISU_O_CONNOBJ_ACTION
    ISU_O_CONNOBJ_CLOSE
    If you only want to change address information you could use functions from the central address management, of course.
    Yep
    Jürgen

  • Threaded Queries from Single static Connection object - Good approach?

    Hi,
    I need to generate a report where I need to query count(1) from over one hundred tables from oracle 10g database. I am not updating or deleting any record.
    My approach is to use a single static connection object and create one thread for each table and capture the result back into a static hashtable.
    But still, I am not getting any substantial performance improvement. Earlier, my report took 40 minutes, when it was non-threaded and now it takes 30 minutes.
    Is there anything more I can do to make my report get the counts faster? Will a connection pool help?

    Tolls wrote:
    jschell wrote:
    I was told by the DBA that count(1) works faster than count(*)....that's why....Unlikely. Certainly not true in current versions of Oracle if that is the source.Not unlikely, actually not true. Beneath the hood Oracle turns a count(1) into a count(*) in order to deal with this. Why? Because count(1) is turned into count(*) in order to avoid it being slower (Oracle 7 was the last time count(1) was different). And the reason generally given is because so many people were mistakenly using count(1) thinking it performed better that they decided to put in the "conversion" to fix the silly queries.
    I think this it the [Ask Tom|http://asktom.oracle.com/pls/asktom/f?p=100:11:109792721681931::::P11_QUESTION_ID:1156159920245] link I used last time this came up here.
    I knew all that, but I missed that the OP had specified the database vendor and version.

  • How many Connections objects????

    Hi
    I am creating a GUI application which contains several GUI classes(e.g. frames and dialog boxes) which are instantiated depending on the choice of the user. I also have a Database class which contains the code which enables the connection to the database. The code creating the connection is within the constructor,therefore creating a connection whever I create an instance of the database class.
    Most of the GUI classes need to obtain or update information held in a database.
    Currently I create an instance of the Database class in every GUI class which needs to access the database. Obviously however every time a new database object is created, a new connection is also created.
    I am worried about all these database objects all containing their own connections.
    Should I have just one connection object in existence at any one time?
    If so,can I declare the Connection variable in the Database class as static?
    Any help/comments would be gratefully received.
    LGS

    From what I know, there should be no problem with maintaining multiple connections to the database. This is a property of the database itself, most allow about 256 connections. The only problem you face is a lost transaction. As long as you keep the queries serialized, you shouldn't encounter any problems.
    If you did want to only have one connection open... why not have another class for that (DBConn) and not instantiate a new connection in the constructor of your Database class. This way, each Database object can use the one connection by all referencing the DBConn object.
    Just a thought...

  • Connection Object

    Dear Friends
    Basically i am new to Jdeveloper
    I have created Master Detail form using Business Object.
    Now i want to add one customize form to Detail form. For that i need Connection object. So how can i create Connection object . pl. help it is urgent for me.
    Can any body know from where i can download API for Jdeveloper.
    Rakesh

    Rakesh:
    I need a few more clarifications.
    Basically I had created DEPT/EMP master detail relation ship. Is this a Business Component project? I.e., did you go through BC4J wizards to create Entity Objects, View Object, etc.? Or are you doing this all in JDBC directly?
    What i want if any body is clicking
    on detail form(emp) , Employee Education should be display in another form. I have made throgh my own java coding(using java.sql).I take it you're not using JClient, but built your own application using Swing. Is this correct?
    Thanks.
    Sung

  • Connection object is getting closed before the stored procedure is complete

    Hi Everyone,
    I am facing an issue where by the java connection object is closed before the stored procedure it is connected to is complete.
    I am not sure if the fault is in SP or Connection pool.
    After spending some time, i could able to figure out that the procedure is taking a tad more time for processing as there are over 1000 records in the database tables it is dealing with.
    Would that be a potential cause ? or Am i required to handle it in Java only ?
    I want to know what could be possible causes for this issue ?
    Please Help.
    FYI,
    The following are the logs which says,
    XYZ (Stored Procedure) : Start Time is 1349217771302 Procedure started here
    INFO >2012-10-02 18:43:09,935 [ConnectionPool]: Closing connection: DataSource [ABC](684)
    INFO >2012-10-02 18:46:03,512 DAO[main]: XYZ : End Time is 1349217963512 Procedure ended here
    Thanks in Advance.

    Hi ,
    Thank you all for your quick response.
    Well it's my bad i dint provide you any code to look into thinking that i am dealt with a gen issue and also i am too paranoid to post any code i am dealing with in the forum (i am sorry).
    But here is some information for you,
    Database : Oracle 10g
    Java: 1.5 version
    We are using only One connection object for the entire java backend process .
    The SP is of over 1000 lines of code which for obvious reasons i can't past it here but this morning i figured out an issue in SP where by a query taking way more than usual time to execute which led to SP's poor performance and also the reason for why it is taking very long time than usual.
    This query is a simple SELECT query where it is trying fetch over 2000 records from a table of over 3 million records. The execution time is over 30-40 seconds which is the root cause of SP's poor performance.
    When i eliminated this from the logic and ran the query it could able process (inserting huge volume around 5000 records of data) in 1 second instead of 3-4 minutes earlier.
    I tried to replicate this issue (which occurred in our production server) in my local system but no luck as there was no connection issue here but only the substantial time difference.
    We are using a customized connection pool which is as follows,
    I am not sure what's going on here because it seems to be greek and latin to me.
    What we are doing in our DAO is we are using method of the below ConnectionPool.getInstance(SCHEMA) to get the connection object.
    Looking forward to seeking advice from you on how connection pool in general works.
    public class ConnectionPool extends Thread
         private static final ConnectionPool me = new ConnectionPool();
         private Hashtable dataSources = new Hashtable();
         private static final int MIN_TIMEOUT = 0;
         private long timeOut;
         private Hashtable cons = new Hashtable();
         private Hashtable active = new Hashtable();
        private boolean trace = false;
         private ConnectionPool()
              registerDataSources();
              this.timeOut = PropertyManager.getIntProperty("connectionPool.timeOut", MIN_TIMEOUT);
              setName("ConnectionPool");
              setPriority(MIN_PRIORITY);
              if (timeOut > 0)
                   start();
         private void registerDataSources()
            dataSources.clear();
              Properties props = System.getProperties();
              String app = props.getProperty("X", "Y");
              for(Enumeration e = props.keys(); e.hasMoreElements();)
                   String key = (String) e.nextElement();
                   if (key.startsWith(app + ".connectionPool.dataSources.") && key.endsWith(".selector"))
                        String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".selector".length());
                        LogManager.logStatus("Registering [" + ds + "] (selector) " +
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector"));
                        dataSources.put(ds,
                             new GenDataSource(
                                  ds,
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector")));
                        continue;                    
                   if (!key.startsWith(app + ".connectionPool.dataSources.") || !key.endsWith(".server"))
                        continue;
                   String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".server".length());
                   try
                        LogManager.logStatus("Registering [" + ds + "] " +
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"));
                        loadDriver(props.getProperty(app + ".connectionPool.dataSources." + ds + ".driver"));
                   catch (Exception se)
                        LogManager.logException(se);
                   GenDataSource genDataSource = new GenDataSource(
                             ds,
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".useMatrix", "false").equals("true"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".server"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".user"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".password"));
                   // Set the schema if schema is defined in settings.xml file
                   if (genDataSource != null && props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema") != null ) {
                        genDataSource.setSchema(props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema"));
                   dataSources.put(ds, genDataSource);
         public static Connection getConnection(String dataSource) throws SQLException
              GenDataSource ds = (GenDataSource) me.dataSources.get(dataSource);
              if (me.timeOut <= 0)
                   if (ds.getSchema() != null )
                        return updateSchema ( ds);
                   else
                        return DriverManager.getConnection(ds.url(), ds.user(), ds.password());
              String key = dataSource;
              Stack free;
              GenPooledConnection pc = null;
              synchronized (me)
                   if ((free = (Stack) me.cons.get(key)) == null)
                        free = new Stack();
                        me.cons.put(key, free);
                   if (!free.empty())
                        pc = (GenPooledConnection) free.pop();
                   if (pc == null)
                        if (ds.getSchema() != null )
                             pc = new GenPooledConnection("DataSource [" + key + "]",
                                                 updateSchema ( ds), free, me.active, me.timeOut, me.trace);
                        else
                             pc = new GenPooledConnection("DataSource [" + key + "]",
                                       DriverManager.getConnection(ds.url(), ds.user(), ds.password()), free, me.active, me.timeOut, me.trace);
                   else
                        pc.touch();
              LogManager.logStatus("Using " + pc);
              me.active.put(pc.id(), pc);
              return pc;
         public void run()
              for(;;)
                   try
                        sleep(60 * 1000);
                        synchronized (me) {
                             for(Enumeration e = cons.elements(); e.hasMoreElements();)
                                  Stack stack = (Stack) e.nextElement();
                                  for (int i = stack.size()-1; i >= 0; i--)
                                       GenPooledConnection pc = (GenPooledConnection) stack.elementAt(i);
                                       if (pc.isExpired())
                                            stack.removeElementAt(i);
                   catch (Exception e)
                        GenUtil.reportException(e);
         private static Connection updateSchema ( GenDataSource ds) throws SQLException {
              Connection con = DriverManager.getConnection(ds.url(), ds.user(), ds.password());
              if (ds.getSchema() != null ) {
                   String sql = "SET SCHEMA  " + ds.getSchema()+ ";";
                   LogManager.logDebugMessage("updating the Schema with sql statement " + sql);
                   PreparedStatement ps = con.prepareStatement(sql);
                   ps.execute();
                   ps.close();
              return con;
    }Thanks.
    Edited by: EJP on 5/10/2012 14:09: added {noformat}{noformat} tags. Please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Connection object from application module

    hi
    i was wondering if there is someway to retrieve the Connection object from the application module. something like:
    java.sql.Connection conn = appMod.getConn();
    i'm using JDeveloper 9.0.3.4
    Thanks in advanced
    Vitor

    Take a look at
    http://radio.weblogs.com/0118231/2004/01/30.html#a232
    Sascha

  • Connection object creation error(ES55)

    Dear Friends,
    When I try to create a connection object using tcode ES55 I am getting an error "Alternative ID Not supported", Message E7045, "An alternative indicator is active in Customizing of the functional location. This functionality is not supported for connection objects and device locations".
    If I deactivate at Functional Location Level, system asks activation settings are not maintained.
    Can somebody guide me on this issue.
    with regards,
    Dayanand

    Dear william,
    I am not able to execute tcode ES55, becoz if I activate alternate labeling, system throws an error to deactivate it. If I deactivate it system throws an error to activate it.
    Please suggest how to overcome this. We are using IDES 800 only. Do we need to update any patches.
    with regards,
    Dayanand

  • Connection object creation

    Hello
    We are developing a website using the java technologies.
    We are not using the connection pooling for connecting to the database. We use a static connection object and calling it in all the pages.
    Is there any other good method for connecting to a database?

    Writing to memory purpose is storing memory
    Static connection should not use for data entry operation (if there is any common insert, update or delete statement exists). If any one of the client gives a commit cases all the database entries of the particular connection will be committed. In the case of display purpose static connection will not cause any problem.
    If u r requirement is for data entry then try to use one method.. Whenever user logged in create a unique id and create a connection for this particular user. Then store this connection as well as id in a static hashmap in servlet. This id should be attach in all the further requests for retrieving the connection..
    If anymore clarification needed
    Mail me
    [email protected]

  • Where to store the Connection object?

    Hi,
    I am using JDBC together with JSF technology to building web applications. I have the following questions:
    1. Where do we usually store the open Connection object so that every class in my web application can make use of it to update or retrieve database data?
    2. Since JSF uses managed-beans which is not a servlet itself, if I store the Connection object as an attribute in the application scope then it can only be retrieved from a servlet.
    3. If I make the Connection object on every class where I would like to have database access, it seems that it is not following good practice since this would create duplicate codes in every Java class which is going to have database access.
    Does anybody have an idea? Thank you.

    Hensome wrote:
    1. But how do I use the managed bean within a servlet? Could you write some simple sample codes?
    2. If I only use simple navigation rules and backing beans, when the submit button is clicked then the action method of the managed bean is triggered. I will then trigger the action which uses JDBC for database access. This whole process does not go through a particular servlet. Is this also possible? If yes, how?
    Thank you.the process does run through a particular servlet, it's the faces servlet and is defined by something that looks like
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
      </servlet> in your web.xml file. You don't have direct access to it, but you can save references to objects in the session or request so other objects can access it. Lets say that your faces code uses a DAO to read some data and you want to pass the data to a servlet, what you need to do something like:
         List data = myDAO.read();
         FacesContext facesContext = FacesContext.getCurrentInstance();
         HttpSession session = (HttpSession)facesContext.getExternalContext().getSession(true);
         session.setAttribute("myData", data);this will save the data object or list in the session as an attribute. Then, when the other servlet runs, you can do something like:
    public void doPost(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
         HttpSession session = request.getSession(false);
         Object obj  = session.getAttribute("myData");
         List myData = (List)obj;
    }          Now the servlet has access to the list of data read by the faces bean. You shouldn't directly access faces beans themselves from another servlet, you should instead access POJOs that you have defined or collections of them.

  • Significnce of making the Connection object explicitly as null

    Iam using java.sql.Connection object to make connection to DB400 database and in the finally block closing the connection as con.close();
    90% of the time query is executing fine and getting correct results. But some times the updated values in the data base are not getting reflected in the result set. ie: ResultSet object is not refreshing properly(not always but sometimes). After making the code in the finally block as follows I feel it is working fine
    if(con != null)
    con.close();
    con=null;
    Can some one explain the significance of making an object explicitly to null.

    I am facing the same issue again. The resultSet and the stament are getting closed properly but the query is not fetching the updated results. If i execute the same query using a client(WinSQL), then the updated values are reflected. Also if i change any of the where conditions in the query(adding one more 'and' condition or 'or' condition ), then the query is giving correct results. Is there any resultSet caching occurs in websphere

  • Uusing Beans to hold Database connection objects

    Hi,
    I am kind of new to Java. I wanted to create a db connection object and use the same in the rest of the pages within the session.
    In the first page I got the connection object and along with other values I created a bean with scope session and stored the connection object using the setProperty method.
    In the next page I retrieve the values using the getProperty method and pass the connection object to a method which updates the database.
    When I execute this I get a Runtime error pointing to the method invoked. When I execute the method in standlone mode calling from main method it executes fine.
    Can anyone tell me if there is a problem when storing and retrieving objects using the setProperty and getProperty methods.
    Regards
    VM

    For application listeners, see http://www.onjava.com/pub/a/onjava/2001/04/12/listeners.html and also JavaDocs at sun.( ServletContextListener class is in javax.servlet package )
    You should do the initialization and putting the instance in application scope in public void contextInitialized(...) method of your listener, by for example block of code like,
    public void contextInitialized( ServletContextEvent sce ) {
         // Gettin' your servlet context object for current web application
         ServletContext application = sce.getServletContext();
         // instanciate your DB bean
         MyDataPool db = MyDataPool.getInstance();
         // puttin' instance in scope for later use
         application.setAttribute( "db", db );
    This causes you when needed, use ServletContext's getAttribute( "db" ) method to retrieve your database.
    for now you just need to add to your "web.xml" <listener> element for your listener class.
    <listener>
         <listener-class>mypackage.MyServletContextListener</listener-class>
    </listener>
    i hope these helps ;)

Maybe you are looking for