Single database connection/detecting disconnect

I receive an error when attempting to connect to the database after the database had gone down and was subsequently brought back up. The code checks to see if the connection 'isClosed' but this method seems to fail under these circumstances. The solution is to re-start the Apache server and log on. Is there a fix to prevent the error message? The connection is created by the first person to login and is maintained through subsequent database requests.
Below is code to test for an existing connection......
public Stuff[] getStuff() throws DBException {
try { synchronized(dbConn) {
if(dbConn.isClosed()) { this.dbInit(); }
//etc,etc,etc
Below is code for dbInit method.......
private void dbInit()     throws DBException {
String getStuff="SELECT * from tbl WHERE uname = ?";
try {
Class.forName(driverName);     
dbConn = DriverManager.getConnectio(dUrl,user,pass);
getUserStmt = dbConn.prepareStatement(getStuff);
catch (ClassNotFoundException     exc) {     
throw new DBException("No Driver Available!")}
catch     (SQLException exc) {
throw new DBException(exc.getMessage());}

Depending on what DB platform and driver version you're running on I think your best bet is to have Apache create a DB connection pool and have your app pull from the pool. That way Apache always creates the pool on startup and checks the state of connections periodically. Unless you reach the maximum number of connections allowed by security or DB platform you should always have a connection.

Similar Messages

  • Can i use single database connection in a hole java application?

    can i use single database connection in a hole java application?.I have so many forms to use database connection.

    Theoretically you can. Not only theoretically. I've seen lots of application which only uses one database connection (they were using, oracle or mysql)
    The first reply given here assumed that the answer to
    your question depends only on the design of your
    application. That is not true.Yes it's true. Nothing in the original questions says that you aren't allowed to open or close the single connection that you have. It's looks more like the OP is interested in sharing a connection (i.e having a singleton or a connection pool with only one connection)
    It does also depend on the behaviour of the database
    in the background.
    Most databases have a time out for connections that
    are idle Not a problem. Most implementations of connection pools and applications which keeps a connection open have a timer which calls e.g. select * from dual (if you are using oracle) when the connection has been idle for X minutes.
    (some, like db2 on z/OS, even cancel
    connections, that are not idle, if they are open a
    certain amount of time or have reached a given limit
    of cpu seconds.)You would also have that problem if you had a connection pool with several connections.
    In essence: If you have no control over the time
    your application runs (and therefore your connection
    is open) or over type or the configuration of the
    database you are accessing, you can't do it.See above.
    The closest thing to what you want would be using
    PooledConnections, iif those are supported for the
    database you want to access.Not true.
    Kaj

  • Multiple sessions in a single database connection.

    I have copied the following text from Forms Developer2000
    "At runtime, Form Builder automatically establishes and manages a single connection to ORACLE. By default, one user session is created for this connection. However, the multiple-sessioning feature of ORACLE allows a single client to establish multiple sessions within a single connection. ORACLE transaction-management and read-consistency features all are implemented at the session level, so creating multiple sessions allows a single user to have multiple, independent transactions."
    If ORACLE allows a single client to establish multiple sessions within a single connection, I want to leverage on this feature in my application which uses BC4J.
    Can anybody tell me if
    1. its possible achieve this in Java(BC4J).
    2. If Yes, How?
    regards,
    vikrant

    Thank you for your valuable suggestion.
    I believe createing multiple root Application
    Modules, will create as many number of connections to
    database, hence multiple transactions.
    But What I wanted was multiple sessions in a single
    connection, who's behavior will be similar to two
    different connections.Could you tell me the advantage you're looking for in multiple sessions in one connection vs. multiple connections (where connections may be pooled)?
    Thanks.
    Sung

  • Single database connection create and using  all programs jsp and servlet

    Hai
    i am create databaset connection using that all programs how to implement

    Post the steps you managed already. If you don't know anything about how to receive data from a database try this link:
    http://java.sun.com/docs/books/tutorial/jdbc/index.html

  • KIMYONG : Applications Database Connection Pool 관련 parameter 설명

    Purpose
    JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
    The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
    Essentially, each AppsContext has a single database connection associated with it at all times.
    The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
    FND_MAX_JDBC_CONNECTIONS
    ============================
    The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
    FND_JDBC_BUFFER_MIN
    ======================
    The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
    Setting this parameter to "0" will disable maintenance of the buffer minimum.
    However, the buffer maximum will still be maintained.
    Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
    FND_JDBC_BUFFER_MAX
    ======================
    The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
    If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
    determining a dynamic buffer maximum.
    The exact expression used is:
    maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
    where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
    The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
    Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
    FND_JDBC_BUFFER_DECAY_INTERVAL
    ===================================
    The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
    This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
    FND_JDBC_BUFFER_DECAY_SIZE
    =============================
    The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
    FND_JDBC_MAX_WAIT_TIME
    =========================
    The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
    10 seconds.
    FND_JDBC_SELECTION_POLICY
    ============================
    The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
    client's context.
    FND_JDBC_USABLE_CHECK
    ===========================
    The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
    connections to a database that has been restarted.)
    FND_JDBC_CONTEXT_CHECK
    ==========================
    The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
    session context of the connections in the available list.
    FND_JDBC_PLSQL_RESET
    ========================
    The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
    If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
    This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
    The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
    Reference : Note 264599.1

    Purpose
    JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
    The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
    Essentially, each AppsContext has a single database connection associated with it at all times.
    The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
    FND_MAX_JDBC_CONNECTIONS
    ============================
    The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
    FND_JDBC_BUFFER_MIN
    ======================
    The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
    Setting this parameter to "0" will disable maintenance of the buffer minimum.
    However, the buffer maximum will still be maintained.
    Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
    FND_JDBC_BUFFER_MAX
    ======================
    The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
    If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
    determining a dynamic buffer maximum.
    The exact expression used is:
    maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
    where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
    The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
    Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
    FND_JDBC_BUFFER_DECAY_INTERVAL
    ===================================
    The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
    This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
    FND_JDBC_BUFFER_DECAY_SIZE
    =============================
    The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
    FND_JDBC_MAX_WAIT_TIME
    =========================
    The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
    10 seconds.
    FND_JDBC_SELECTION_POLICY
    ============================
    The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
    client's context.
    FND_JDBC_USABLE_CHECK
    ===========================
    The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
    connections to a database that has been restarted.)
    FND_JDBC_CONTEXT_CHECK
    ==========================
    The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
    session context of the connections in the available list.
    FND_JDBC_PLSQL_RESET
    ========================
    The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
    If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
    This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
    The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
    Reference : Note 264599.1

  • ODI database connection - session question

    Hi,
    I have a package, where I have used a procedure.
    In my procedure, I open a database connection.
    My question is - In my next procedure - will I be able to use my same database connection which I created in previous step?
    Re-phrasing the question - for any number of database transaction happening in a package, will ODI opens multiple database connection per step or will there be only one single database connection?
    Thank you,
    Paras

    I believe its one per session so one connection inside the package. I think you should be , although i have not tried it practically.

  • How to disconnect the database connection using crystal report

    Post Author: cp_pramodu
    CA Forum: Crystal Reports
    Hi All,
    We have developed an application using .Net and Crystal Reports 10 for generating Adhoc reports from Business system (db sybase 12). We are using the below mentioned script for opening rpt files.
    Try
           ReportDocument1.Load(sReportName)
           For Each table In ReportDocument1.Database.Tables
                  ' Get the TableLogOnInfo object.
                  logonInfo = table.LogOnInfo
                  ' Set the server or ODBC data source name, database name,
                  ' user ID, and password.
                  logonInfo.ConnectionInfo.ServerName = sReportServerName
                  logonInfo.ConnectionInfo.DatabaseName = DBName
                  logonInfo.ConnectionInfo.UserID = UserName
                  logonInfo.ConnectionInfo.Password = Password
                  ' Apply the connection information to the table.
                 table.ApplyLogOnInfo(logonInfo)
    Next
    'Me.Cursor = Cursors.WaitCursor
    Me.CrystalReportViewer1.ReportSource = ReportDocument1
    'Me.Cursor = Cursors.Default
    Catch ex As Exception
    'Response.Write(ex.Message)
    Finally
    Me.Cursor = Cursors.Default
    'ReportDocument1.Close()
    'ReportDocument1.Dispose()
    End Try
    Each time user opens the report a new connection is established to the database, can we disconnect the connection established from crystal reports, while closing crystal report. At the same time i want to setup an Idle time for these connections. In database level, i will not be able to set idle time in database level, as it affect our electronic channels.
    Waiting for a reply.
    Thanks & Regards,
    Pramodu. C. P

    Hi,
    If you are reworking the application can you not build in the functionality to re-establish a connection if there is a failure? That is, a submission from the application server to the database server detects a failure, etc. and then re-establishes the connection. If you need a more frequent check than during a user-initiated roundtrip, you may be best served by using the "dummy query" technique on some time interval.
    From my understanding using HA Event Notification would require a RAC database (plus a multi-threaded application and services correctly configured on the RAC-side).
    In the documentation I see this:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci09adv.htm#sthref1495
    "Applications must connect to a RAC instance to enable HA event notification."
    In any case, this has the potential to be a bit complicated...
    Regards,
    Mark

  • Multiple DataBase Connection in a Single Form

    hi all
    Is it Possible to have Multiple Database Connection With a Single Form
    Block a : Retriving data from a database Service a/Schema A.
    Block b : Retriving data from a Remote Database Service b / Schema B.
    If yes how to do this.
    regards
    jai
    email:[email protected]

    Sure you can access a database this way,
    but can you base a block on this database connect? No you can't.
    Frank

  • Database connectivity in single class

    Hi,
    I am currently developing an application which reads and writes to an access db. For my current problem I use three tables which reference to each other:
    Table 1: organization (id, name)
    Table 2: departments(id, name, id_of_organization)
    Table 3: personel (id, surname, firstname, id_of_department, id_of_organization)
    Since I do not like managing the database connectivity in each and every class I wrote a class that manages database connectivity and has one public function which accepts a string as argument ( the SQL string) and returns a ResultSet after executing the query. Every class that uses the database has an instance of the "database class".
    When listing the personell I would like to list the names of departments and organization, not the id's. The listing is accomplished by moving through the resultset in a while loop (while(rs.next()) )and retrieving the data using the getString() method. In the while loop I also retrieve the other data using the id's.
    The problem is that as soon as I retrieve department or organization data the ResultSet containing the personell is closed (even though it is a mere copy of the original ResultSet of the "database class").......
    My application (very much shortened of course ;-))
    The "database class" DbConnect.class
    /* Header, initialize connection and so on*/
    public ResultSet Query(String queryIn)
    // execute Select Query and return Result as ResultSet
    try
    rs = stmt.executeQuery(queryIn);
    rs.first();
    catch(SQLException esql)
    JOptionPane.showMessageDialog(null, "Fehler in SQL Verbindung: " + esql.getMessage());
    return rs;
    What I do later:
    /* some code
    DbConnect database = new DbConnect();
    ResultSet personell = database.Query("SELECT * FROM personell");
    while (personell.next())
    ResultSet department = database.Query("SELECT name FROM department WHERE id = " + personell.getLong("department"));
    System.out.println("Name: " + personell.getString("name") ....... and so on, never gets executed since the SQL exception "ResultSet closed" is fired.
    What am I doing wrong?

    I agree with your method of doing db access through a single helper class. However there is one glaring problem. After each statement is done you must close the statement and the connection. Now you really want to do this in the Query() method, but you can't because you expose the ResultSet to the world and require clients to close the statement and connection that they can't see.
    The solution is to package the result set into another collection, then close the statement and connection. Here's code that I use for executing arbitrary queries with a dynamic number of parameters. I use a map in this example to store each rows column values, but you can also use a List of Arrays or a List or Lists or a List of Value Objects.
       * General purpose Query executor method.
       * Statements to be executed MUST return result sets.
       * A list entry is created for each row which contains a Map of
       * column values, keys are the column names, therefore each computed column in
       * the query must be named.
       * @param sql The sql to execute
       * @param connection An open DB Connection
       * @param params Array of params to be applied to the statement. The number of
       * parameter holders in the SQL statement must match the number of entries in this array.
       * @param list instance of a List, that will be populated with results.
       * @throws SQLException
      private static final void executeQuery(final String sql,
                                             final Connection connection,
                                             final Object[] params,
                                             final List list ) throws SQLException {
        PreparedStatement statement = null;
        try {
          statement = connection.prepareStatement(sql);
          /* populate any parameters */
          for (int i = 0,j = 1; i < params.length; i++,j++) {
            statement.setObject(j,params);
    ResultSet rs = statement.executeQuery();
    /* Get meta data for column names and #columns */
    ResultSetMetaData rsmd = rs.getMetaData();
    int columns = rsmd.getColumnCount();
    /* Process each row */
    while (rs.next()) {
    HashMap map = new HashMap(columns);
    list.add(map);
    /* Process each column */
    for (int i = 1; i <= columns; i++) {
    map.put(rsmd.getColumnName(i),rs.getObject(i));
    } // for
    } // while
    } // try
    finally {
    if(statement!=null) statement.close();
    if(connection!=null) connection.close();
    } // executeQuery()

  • Parallel database connection​s and single query between databases

    Hi, I am looking to execute this SQL query between 2 different databases to update a local database based on data selected from a remote one.
    e.g.:
    - Local database name: db1
    - local database schema: dbo
    - local database table1
    - remote database name: db2
    - remote database schema: dbo
    - Remote database table: table2
    - Query: "SELECT * FROM db2.dbo.table2 WHERE NOT EXISTS(SELECT * FROM db1.dbo.table1)" <- This gets e the record set i would need to insert, and I already have a vi to do that kinda thing.
    How do I go about this?
    Thanks,
    Mohamed

    Mohamed,
    There is a VI in the Database Connectivity Toolkit that allows you to execute SQL queries:  DB Tools Execute Query.
    http://zone.ni.com/reference/en-XX/help/370016E-01​/lvdatabase/db_tools_execute_query/
    Is this what you are looking for?
    Drew T.
    NIC AE Specialist

  • Database No connection detection

    I remember in the older versions of Coldfusion in the
    administrator there was the odbc page. On this page there was a
    status of the connections. Is there any CF tag/function that
    determines if a database connection is working?
    Thanks
    Dave

    > Is there any CF tag/function that determines if a
    database connection
    Have you considered using...
    CreateObject("component","cfide.adminapi.datasource")
    Good luck!

  • Parameter insert database connectivity

    I'm currently having a little trouble getting this to work.  Below is a picture of my block diagram, it includes pretty much everything there is to know about my error. As you can see it says it has a syntax error. I'm fairly new to labVIEW but I do quite a bit of database programming. The insert statments looks correct. I would assume the error lies within the values passed into the parameters. I've tried it both with and without single quotes around the values. I would also like to note that the 2 int32 convertsion were thrown in after the error was already there. Was just running out of ideas to try. Incase you can't recognize the VI. We have an open database vi -> parameterized query -> 2 set parameters -> exec query-> free object-> free conn-> close conn. This is the exact same layout for the database connections as is in the database connectivity manual. I've already tested the connection to the database inserting a single value and that worked. For some reason now that I'm spliting the values coming out of the DAQ assistant and made it a parameterized query, it is no longer working. Any help would be great. Thanks.

    [As far as the special characters in the insert
    string I wouldn't believe there would be any unless they some how get
    added automatically. If they are is that a common issue? ]
    I was just making sure human error didn't creep in when the INSERT string was created. It's bit me more than once.
    Have you tried hard coding some Voltage and Current values into the Set Parameter Value VI's? You might also try setting the "auto-detect parameters" in the Create Parameterized Query VI to TRUE and disconnecting the Parameters array constant. Also, check the string "Current" in the Parameter constant array (index 1), make sure there's no space at the end of the name.
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx

  • Jdev 10g Preview Database Connection Error

    HI,
    I'm trying to create a database connection in Jdev 10.1.3.0.2 .
    When i press "Test Connection" i receive the following error.
    ORA-00604: error occurred at recursive SQL level 1
    ORA-12705: invalid or unknown NLS parameter value specified
    I used previous versions or JDev and never had this problem.
    Thank You. JP.

    I'm using the Jdev 10.1.3 default installation.
    I didn't change anything.
    Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production (AIX)
    With the Partitioning option
    JServer Release 9.2.0.5.0 - Production
    This is the jdev.conf file. I don't know what is wrong.
    I tried deleting the lines where is "AddVMOption -Doracle.translated.locales=ja ", but i receive the same error.
    Thank you. JP.
    # Oracle JDeveloper 10g Launcher Configuration File
    # Copyright 2000-2004 Oracle Corporation.
    # All Rights Reserved.
    # The format of this file is:
    # "Directive Value" (with one or more spaces and/or tab characters
    # between the directive and the value) This file can be in either UNIX
    # or DOS format for end of line terminators. Any path seperators must be
    # UNIX style forward slashes '/', even on Windows.
    AddJavaLibPath ../lib/patches
    AddJavaLibFile ../../../classes
    AddJavaLibFile ../../ide/lib/javax-ide.jar
    AddJavaLibFile ../../ide/lib/javatools.jar
    AddJavaLibFile ../../ide/lib/ide.jar
    AddJavaLibFile ../lib/looks-1.2.1.jar
    AddJavaLibFile ../../jlib/jewt4.jar
    AddJavaLibFile ../../jlib/share.jar
    AddJavaLibFile ../../jlib/help4.jar
    AddJavaLibFile ../../jlib/inspect4.jar
    AddJavaLibFile ../../lib/xmlparserv2.jar
    AddJavaLibFile ../lib/jdev-ep.jar
    SetUpdateMainClass oracle.ideimpl.webupdate.DeferredUpdater
    SetUpdateClassPath ../../../classes:../lib/jdev.jar:../../ide/lib/ide.jar:../../ide/lib/javatools.jar:../../lib/xmlparserv2.jar:../../jlib/jewt4.jar:../../jlib/share.jar
    # Extensions in jdev/lib/ext may require native libraries
    AddNativeCodePath ../lib/ext
    # Oracle9i Lite Settings
    # Enable these lines (and modify the directories)
    # to suit your Oracle Lite installation
    # AddNativeCodePath C:/Oracle/lite5/mobile/sdk/bin
    # AddJavaLibFile C:/Oracle/Lite5/mobile/classes/olite40.jar
    # Directive SetJavaHome is not required by default, except for the base
    # install, since the launcher will determine the JAVA_HOME. On Windows
    # it looks in ..\..\jdk, on UNIX it looks in the PATH by default.
    # SetJavaHome c:\jdk1.4.2_03
    # The Windows launcher will attempt to use client (hotspot) by default,
    # unless a VM is specified below with the following directive. On UNIX
    # we use whatever is listed first in the $(JAVA_HOME)/jre/lib/jvm.cfg file.
    SetJavaVM hotspot
    # JDK 1.4.2 specific setting, to properly run JDeveloper under JDK 1.4.2,
    # the following property needs to be enabled and set to false. The bug
    # (Sun bug #4895132) has been fixed in JDK 1.5.
    # AddVMOption -Dsun.io.useCanonCaches=false
    # This will enable a "virtual" file system feature within JDeveloper.
    # This can help performance for projects with a lot of files,
    # particularly under source control. For non-Windows platforms however,
    # any file changes made outside of JDeveloper, or by deployment for
    # example, may not be picked by the "virtual" file system feature. Do
    # not enable this for example, on a Linux OS if you use an external editor.
    # AddVMOption -DVFS_ENABLE=true
    # Turn off verifications since the included classes are already verified by the
    # compiler. This will reduce startup time significantly. On some Linux
    # Systems, using -Xverify:none will cause a SIGABRT, if you get this, try
    # removing this option.
    AddVMOption -Xverify:none
    # Set the maximum heap to 512M
    AddVMOption -Xmx512M
    # MaxPermSize is required to run JDeveloper with Sun Microsystems virtual
    # machine (-client and -server). The default value is 64M, which isn't enough
    # to run JDeveloper successfully. With the default value, JDeveloper will
    # end up running out of memory at some point in time. This option is ignored
    # by OJVM (-ojvm).
    # This option is documented at:
    # http://java.sun.com/docs/hotspot/gc1.4.2/faq.html
    AddVMOption -XX:MaxPermSize=128M
    # Option used by OJVM client on Windows, This option will turn on line numbers
    # in the stack traces by disabling the optimizing compiler.
    # AddVMOption -XOd
    # Enabling this option will cause OJVM client on Windows to only use 1 CPU on
    # a multi-processor system, on single-cpu systems, this option has no effect.
    # AddVMOption -Xsinglecpu
    # Disable Direct Draw, on some Windows 2000/XP base computers,
    # Direct Draw is cause excessive screen refreshes and slows down drawing.
    # Disabled by default for all Windows platform.
    AddVMOption -Dsun.java2d.noddraw=true
    # If true, prevent laucher from handle -help command line argument and
    # passes -help to the java application.
    # Disabled by default
    # AddVMOption -Dapplication.handle.help=true
    # If set to true, prevent laucher from checking/setting the shell
    # integration mechanism.
    # The shell integration feature is enabled by default
    # AddVMOption -Dno.shell.integration=true
    # Disable the forced GC for the ICE browser.
    AddVMOption -Dice.browser.forcegc=false
    # Reduce the tile threshold for the ICE browser.
    AddVMOption -Dice.pilots.html4.tileOptThreshold=0
    # Prepend patches to the bootclasspath. Currently, rtpatch.jar contains a
    # patch that fixes the javax.swing.JTree accessibility problems.
    # Uncomment the line below if you need to run JDeveloper under JAWS.
    # AddVMOption -Xbootclasspath/p:../../jdk/jre/lib/patches/rtpatch.jar
    # Replace heavyweight AWT controls with lightweight implementations.
    AddVMOption -Xbootclasspath/p:../lib/lwawt.jar
    # This setting must not be changed.
    SetMainClass oracle.jdeveloper.JDeveloper
    # SetUserHomeVariable is used to define an environment variable
    # that overrides the default user home location. The directory
    # pointed to by the environment variable defined here will be
    # used to store user settings and the "mywork" directory.
    # On UNIX platforms the default setting is $HOME/jdevhome
    SetUserHomeVariable JDEV_USER_DIR
    # If you run into problems related to relocation errors of system dll's, use
    # this option to resolve them. This option only works under ojvm.
    # AddVMOption -Xheapbase10000000
    # A list of filenames that are reserved
    AddVMOption -Dreserved_filenames=con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout$
    # Indicates which version of the jdk to use for editor syntax
    # highlighting and code explorer. Valid values are: "1.3", "1.4", "1.5".
    AddVMOption -DEDITOR_J2SE_VERSION=1.5
    # Whether Code Insight will omit types and members that have been
    # denoted with the @hidden tag.
    AddVMOption -DINSIGHT_OMIT_HIDDEN=true
    # Text buffer deadlock detection setting (OFF by default.) Uncomment
    # out the following option if encountering deadlocks that you suspect
    # buffer deadlocks that may be due to locks not being released properly.
    # AddVMOption -Dbuffer.deadlock.detection=true
    # If you use JDeveloper in a multibyte environment the embedded browser
    # may display all multibyte characters as squares. If this happens you
    # can use the following option to avoid the problem.
    # AddVMOption -Dice.pilots.html4.ignoreNonGenericFonts=true
    # Put the xml parser into 9.0.4 compatability mode (3116160)
    AddVMOption -Doracle.xdkjava.compatibility.version=9.0.4
    # Specify the set of extant translations for resources loaded via
    # BundleLoader. The format is a comma separated list of locales, for
    # example ja,fr_CA. A translation will only be found if included in
    # the list.
    # Comment out the option to force BundleLoader to use the default
    # locale. This is different to giving the property no value,
    # meaning there are no translations.
    # Note that this has no impact on ResourceBundle, which will continue
    # to try to load locale specific resources even if they are certain not
    # to exist.
    AddVMOption -Doracle.translated.locales=ja
    # Temporary internal flag to enable trace messages for the IDE
    # controller stack.
    AddVMOption -Dide.debug.controller.stack=false
    # If you need to connect to OC4J 10.1.2 from JDeveloper, uncomment the
    # following option. Note, however, that enabling this option will prevent
    # JDeveloper from connecting to OC4J 10.1.3.
    # AddVMOption -Drmi.disablePropagation=true
    AddVMOption -Doracle.translated.locales=ja

  • Different database connection or proxy user change

    Hi forms guys,
    in everyday life I am fulltime DBA, so please forgive my spare forms word pool.
    Our users open a forms application that displays a menu with forms applications the user has access to. Users can then click on the menu items and another form pops up. Now having reviewed the code, I can say that the opening of the new forms is done by calling the builtin OPEN_FORM. As parameter "SESSION_MODE" for this function, "SESSION" is supplied. If I understand correctly, this means that another session using THE SAME username/password/connectionstring is created (for the purpose of parallel transactions in parent and child form).
    At the moment each and every user (~400) has it's own database account which has roles (depending on the applications they are granted access to) assigned and also sometimes owns dblinks and synonyms. We want to get rid of them by storing the credentials in OID and just create ONE single application user for every application we host. This user shall contain all nescessary objects such as dblinks and private synonyms.
    The enduser then logs in using the proxy mechanism. For example if user XYZ (defined in OID) wants to start application ABC, then he/she connects like XYZ[ABC_APPUSER]/XYZPASSWD. This must occur when the form opens, directly after the OPEN_FORM call.
    Now my question: Is this possible somehow? Is there a way to have different database connections within a single forms window, if there are different forms? Or is it possible to make a switch to another proxy user within forms? e.g. JDBC has the ability to quickly switch to an other proxy user, without having to re-establish the whole session.
    All I have read so far tells me, that it is not possible. But I would really like to hear that acknowledged by experts. Also other, perhaps better ideas for our intention are welcome.
    Kindest regards
    Matschbirne

    Not really sure how to answer your question other than to say that from within your form's pl/sql you can connect and disconnect as often as you like programatically. However, you can only have one connection at a time (as far as I know). So if you connect as SCOTT and later want to do a login as FRED, you can do so, but SCOTT will no longer be connected.
    Forms does support using Oracle SSO, but for the most part cannot directly access OID. Also, the db login information needed by Forms (when using SSO) is stored in a RAD (Remote Access Descriptor) in OID. The RAD behavior is unique to Forms and Reports. For each SSO user there is a related RAD. At the moment, there is no provided way to have RAD groups (e.g. Admin, Sales, Guests, etc). So each user get their own RAD.
    If you are using Forms 11.1.x, Forms now supports db proxy users.
    More information about SSO and Proxy users with Forms can be found in the Forms Deployment Guide:
    http://docs.oracle.com/cd/E24269_01/doc.11120/e24477/sso.htm
    In the code, you can control the connection using the LOGON, LOGOUT, and LOGON_SCREEN built-ins. Refer to the Forms Builder online help for details on how to use these.

  • THE DATABASE CONNECTION IS LOST :;; WIERD  ORA-01012 NOT LOGGED ON ERROR

    ERROR: ORA-01012 NOT LOGGED ON ERROR
    I AM USING A JAVA SWING INTERFACE (JDK 1.1.8), WHICH USES JNI TO CALL C PROGRAMS WHICH IN TURN CONNECTS TO THE DATABASE, ORACLE 8.1.6.
    A DATABASE CONNECTION IS ESTABLISED IN THE MAIN CLASS BY CALLING A FUNCTION FROM THE CONSTRUCTOR.
    FOR ALL OTHER FUNCTION CALLS WHICH ARE MADE FROM WITHIN THIS CONSTRUCTOR, THE CONNECTION STAYS.
    BUT AFTER THE CONTRUCTOR CALL IS COMPLETE, DATABASE CONNECTION IS STRANGELY LOST. THUS ALL OTHER FUNCTION CALLS FAIL BECAUSE OF CONNECTION ISSUES GIVING ORA-01012. THOUGH IF I CHECK UP IN THE DATABASE, THE CONNECTION DOES FIND AN ENTRY.
    SO IT APPEARS THAT SOMEHOW THE JAVA INTERFACE LOOSES TRACK OF CONNECTION. BUT STRANGELY ALL THE FUNCTIONS WORK IF CALLED FROM THE CONSTRUCTOR......... BUT THATS NOT THE IDEA.
    PLEASE HELP, THIS PROBLEM IS BUGGING ME FOR WEEKS NOW.
    THANKS
    AMIT

    apologise for the caps lock.
    i am working on a previous system with java swing front end which alread uses jni, and connects to database using pro *c.
    My problem is that the connection is lost as soon as the constructor of the main class is run, giving an
    ORA-1012 NOT LOGGED ON ERROR.
    But if i place the same calls in the contructor all the database call work.
    It somehow appears that the java interface looses the connection context. Though the session does find entry in the oracle dynamic tables as long as i dont close the front end main window, thereby meaning that its the jave interface which looses the context.
    part of the code of the main class eiquser.
    //constructor
    public EiqUser() {
         super();
         initMRI();
    private void initMRI() {
         try {
              /* initialize geoManager environment */
              int rccc = new EiqCfuncs().eiqInitEnv();
    //eiqinitenv is a c function which connects to database using pro *C
              EiqCfuncs cfuncs = new EiqCfuncs();
              //EiqCfuncs has the prototypes of c functions used bye the java interface
              this.ivjFileMenu.setText(cfuncs.eiqGetText(resNum.getTEXT_FILE_MENU())); // sets the menu name
    and so on.........
    public void eiqUser_WindowClosed(java.awt.event.WindowEvent windowEvent) {
         new EiqCfuncs().eiqTermEnv(); // gives ora-1012 error
    //eiqtermenv is supposed to disconnect from data base, but returns an ora-1012 not logged on erro
         return;
    //eiqtermenv closes the connection with the data base. But fails in this case. if i place the same call ( eiqtermenv) in the initMRI function or the contructor it succeeds.
    Plus if i dont use the java interace and use a c stub for executing the same sequence of functions, then i dont face any problems.
    the proc calls exectuted ultimately by...
    :::eiqinitenv
    exec sql connect using :sqlid identified by sqlpw; // succeeds giving sqlerr.sqlcode=0;
    ::::eiqterm env
    exec sql commit work; //fails giving 0ra-1012 error
    exec sql rollback work;
    Why is the java interface loosing track of the connection once done with the constructor of the main class?? The session still finds an entry in the oracle dynamic tables.
    Please help
    Thx
    Amit

Maybe you are looking for