Database events

Hi I am connecting to Oracle 9 database using OracleInProcServer library from my .NET 1.1 project.
I want to use database events so Oracle can notify me of a change in database.
My code:
Dim gOraSession As Object
Dim gOraSubscriptions As OracleInProcServer.OraSubscriptions
Dim gOraDatabase As OracleInProcServer.OraDatabase
gOraSession = CreateObject("OracleInProcServer.XOraSession")
gOraDatabase = gOraSession.DbOpenDatabase("<database_instance>", "<username>/<password>", OracleInProcServer.dbOption.ORADB_ENLIST_FOR_CALLBACK)
gOraSubscriptions = gOraDatabase.Subscriptions
gOraSubscriptions.Add("<queue_name>:<subscriber>", DBEventsHdlr, A) --------ERROR
gOraSubscriptions(0).Register()
I get the Type Mismatch error on the line before the last one. What could be the problem?

Hi I am connecting to Oracle 9 database using OracleInProcServer library from my .NET 1.1 project.
I want to use database events so Oracle can notify me of a change in database.
My code:
Dim gOraSession As Object
Dim gOraSubscriptions As OracleInProcServer.OraSubscriptions
Dim gOraDatabase As OracleInProcServer.OraDatabase
gOraSession = CreateObject("OracleInProcServer.XOraSession")
gOraDatabase = gOraSession.DbOpenDatabase("<database_instance>", "<username>/<password>", OracleInProcServer.dbOption.ORADB_ENLIST_FOR_CALLBACK)
gOraSubscriptions = gOraDatabase.Subscriptions
gOraSubscriptions.Add("<queue_name>:<subscriber>", DBEventsHdlr, A) --------ERROR
gOraSubscriptions(0).Register()
I get the Type Mismatch error on the line before the last one. What could be the problem?

Similar Messages

  • How to generate an email on a database event?

    Dear gurus...I've heard about diferent ways of generating email in response to a database event e.g
    1 - Using UTL_MAIL package
    or
    2 - Event Driven Reporting feature of 10g Database and using SRW.Run_Report package to generate and mail a report.
    Now I'm confused that how should I accomplish the following tasks:
    (i) - How to generate an email after Insert/Update/Delete on a table and acknowledge the concerned users about that event?
    (ii) - How to attach a text file with that email?

    Dear Ivan...I've tried both UTL_SMTP and UTL_MAIL, UTL_SMTP is working well and sending mails but following code of UTL_MAIL is giving the error which I can't guess, why?
    DECLARE
    CRLF CHAR(2) := CHR(10) || CHR(13);
    BEGIN
    UTL_MAIL.SEND(sender => '[email protected]',
    recipients => '[email protected]',
    cc => NULL,
    bcc => NULL,
    subject => 'Test Email',
    message => 'Test line1' || CRLF || CRLF || 'Test line2',
    mime_type => 'text/plain; charset=us-ascii',
    priority => 1);
    END;
    and the error is:
    ORA-29279: SMTP permanent error: 554 Message is not RFC compliant
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 345
    ORA-06512: at "SYS.UTL_MAIL", line 577
    ORA-06512: at "SYS.UTL_MAIL", line 594
    ORA-06512: at line 4
    could u guess why this error is generating???
    P.S...I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production on MS-Windows Server-2003.

  • Ingres to Oracle Migration (Database Events)

    I am currently working on an Ingres II to Oracle 8.1.6 migration
    project. The client OpenROAD 3.5/03 application makes extensive
    use of Ingres database events.
    Put simply we have a single master process which services
    requests for orders from a number of child processes. There is a
    desire to minimise the degree of code changes when migrating the
    application. OpenROAD provides the
    DBSessionObject.RegisterDBEvent and RaiseDBEvent methods which
    make underlying calls to the Oracle DBMS_ALERT package.
    The problem we have stems from the fact that Ingres database
    events are broadcast to all sessions registered as having an
    interest, much like the Oracle alerts. However, Ingres events
    are retained in a queue whereas the Oracle alert messages, if
    unread, are simply overwritten.
    I feel the best solution would probably be to use the Oracle
    DBMS_PIPE package and build dedicated pipes between each
    master/child session. However, OpenROAD does not appear to
    provide an interface to this package.
    Does anyone have experience of this problem or have any
    suggestions? I'm looking for information on how other sites have
    successfully migrated between the two products. I did find a
    migration toolkit but it seems to avoid the issue of database
    events.
    Many thanks,
    Max

    hello,
    I am interested on the architecture which you set up to see how
    you reach a base ORACLE from OPENROAD or ABF applications. Have
    you planned to pass in OPENROAD 4.1? do you know the GATEWAY CA?
    Thanks in advance,
    Didier

  • Job on database event

    Hi all,
    I want to create a job based on a database event.
    I want to delete records in a table that are older then for example 4 years old. Tha tabel has a create_date attribute.
    Is this possible?
    Ps.
    Currently I would create a procedure that would check for records older than 4 years and delete them. I would then create a job that runs this procedure every year.
    And then I read about jobs based on events. they work with the concept of oracle messaging and queues. This seemd a better idea.

    Hi,
    I don't think events would work well for your case. Database events are really AQ messages. The database really doesn't send messages, you need to create the infrastructure to enqueue messages or raise alerts yourself.
    In my opinion, building the infrastructure to do this is less efficient and more complex than simply scheduling a job that runs once every so often.
    -Ravi

  • Second opinion : Database events

    I'm probably a bit late but I found Database events and that seems to me something I have to use... Together with SQLlite / applescript...
    But I want a second opinion. Is this is the best way to store my data for free?
    Because when I start using database events I will get big databases with many records and fields,...
    Of course if you have a better suggestion I would like to know it..
    I prefer free / open source solutions. My software budget is zero this year.
    Many thanks.

    What is your primary goal here - to store lots of data, or to AppleScript your data?
    The reason I ask is that Database Events is your simplest path to using a database within AppleScript, however it has a few caveats.
    First is that I don't know anyone that's using it at scale. I've used it myself for small data sets but I don't know anyone storing gigabytes (or terabytes) of data with it. It might be fine - I just don't hear of it happening.
    The second is that, IIRC, Apple have changed their underlying database in the past, so you may need to consider what to do if they repeat that (and whether they'll provide seamless migration tools).
    So if your primary goal is to store lots of data, then there are other, free, solutions out there including MySQL, PostgreSQL and more. Of course, the downside to these is that there is little or no AppleScript integration, so you're limited to interacting with then via shell commands. AFAIK all the other databases that support AppleScript (either directly or via ODBC) are commercial.

  • Database event in caps

    Hi everyone
    I need to know if there's a way to manage database events (such as a row insert) in CAPS. Can I implemlent (or import) a trigger made in SQLServer2000 with SQLServer eway?
    Thanks
    Ivano

    Hi Sohit,
    It must work. you keep a break point and check. I had used the same  same thing in one of my object.
    the logic would be to
    LOOP AT TOTAL.
    Now check the record of TOTAL which you want to check by using offset like  TOTAL+0(4) i.e. the first four characters of the total which is for the first field and by taking it do the validation by checking teh database or whatever if fails raise the error message.
    ENDLOOP.
    If you have any doubt write back i'll help you.
    <b>Kindly reward points if it helps.</b>
    Thanks and Regards
    Tanweer zaki

  • Database Event Subscription with oo4o c++

    Hi,
    how do I subscribe to Database events using oo4o for C++ API? oo4o does provides OraSubscription object but I can't seem to find its equivalent class in C++.
    Your help will be greatly appreciated.

    Hi,
    how do I subscribe to Database events using oo4o for C++ API? oo4o does provides OraSubscription object but I can't seem to find its equivalent class in C++.
    Your help will be greatly appreciated.

  • Refresh on Database Event

    Hi Experts
    I want to refresh my dashboard every time an insert or update statement is executed in the database.
    The only way I found is that i refresh the site periodically ervery minute.
    Is there a chance to refresh the dashboard with a trigger that fires when an insert or update is executed?
    Or do you have any other idea?
    Regards Norbert

    I'm pretty certain event poling isn't going to help. Event poling also runs on a set schedule - it's no different than having a dashboard page automatically refresh on the same interval (assuming no caching is being used). Not sure there's a really good solution for this.
    From a curiosity standpoint - what type of dashboard are you building? Curious to see what the need is for having dashboards update every time a transaction comes through. If you tell us the "why" you want to do this, maybe we could suggest a better alternative (Agents come to mind)
    Thx,
    Scott

  • Database event problem

    Hi all,
    I have a requirement, One table in my database is getting
    updated from a remote application, As soon as the table is
    getting updated or new row inserted , I should be able to trap
    these events and pick up that data so as to store in an Sybase
    databse table. One way I can trap event is "TRIGGERS" but I am
    not allowed to create triggers on the database due to some
    constraint. Is there a way to find in ORACLE other than trigger
    to trap events or to perform some operation as soon as these
    events ( INSERT , UPDATE) are triggered.

    No. That's what triggers are for. Why can't you use triggers?
    APC

  • Send database events at your mobiles by sending sms

    I am sending database alerts at my mobile via send sms and email from oracle database.
    I also generting sms alerts and receiving sms at my cell i.e for data import/export, hendling corporate network ips as well as subnet mask for application and db user login authentication notificatin. All these alerts i reveiving on my cell i.e +92-0300-6653641.
    Any database administrator who is generating this type database triggers i.e how have developed own database firewall for hendling corporate databases (9,10g,11g).
    Thanks
    Naeem Sheeraz
    Faisalabad,Pakistan
    MCS + OCP (Developer Track Developer 2000,6,6i) 10g OCA & OCP
    email : [email protected]
    URL : www.saifisoft.net
    __________________________________________________

    Check this,
    http://decibel.ni.com/content/docs/DOC-9233
    http://decibel.ni.com/content/docs/DOC-7451
    AshwiN,

  • Event 3351, SQL database login for 'DB_Config' on instance failed. Additional error information from SQL server is mentioned below. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

    category-database
    event id-3351
    source-sharepoint foundation
    SQL database login for 'DB_Config' on instance 'DB\instance' failed. Additional error information from SQL Server is included below:
    Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
    I have been getting this error every hour on only 1 application server of the 2.
    My farm consists of 2 app servers, 2 wfes & 2 sql nodes.
    My public site is working fine. Authentication is NTLM.
    SharePoint VSS Writer is disabled.None of my appPool accounts are running under local system.
    I have read many forums/blogs, but couldnt find a solution for this.
    Any help would be appreciated!

    Hi,
    As I understand, you found event id 3351 in event log. Please collect more information as below:
    Check if the error also occurs on other servers in your farm.
    Check if backup job is scheduled at the time when the event id occurs.
    Please run Config Wizard or psconfig.exe -cmd secureresources on all servers and test the issue again.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Events in a maintenance view

    Hi,
    I am doing some validations in the "Before Save to Database" event of a maintenance view. I am accessing the <viewname>_total table in the event and it works fine.
    Now I am using this view in a view cluster. When I maintain the data through view cluster, this event gets triggered but the
    <viewname>_total comes empty. What could be the reason for this? Is there any other alternative?
    Thanks and regards,
    Pankaj
    Edited by: Pankaj on May 12, 2008 11:12 AM

    Hello Pankaj,
    In a View cluster, there are more than one view program being called by a common program. Hence, there is not a single TOTAL or EXTRACT structure for a single view, at any given point of time.
    Instead, you can make use of the form routine vcl_set_table_access_for_obj in your event calls, and read the TOTAL and global variables for your current view. The method interface is like -
      PERFORM vcl_set_table_access_for_obj  USING '(name of your view)'
                                         CHANGING lv_error_flag.
    You can further define local variables/internal tables of relevant structures to read the data into, and proceed to implement your logic.
    More info - [View Cluster Maintenance events|http://help.sap.com/saphelp_47x200/helpdata/en/91/ca9f32a9d111d1a5690000e82deaaa/frameset.htm]
    Best Regards,
    Rekha

  • How to use the table maintenance events for validating the input entries..?

    Hi,
    I have created a Z table with 6 fields in which all are KEY fields. All are of CHAR type. I have created the Table Maintenance Generator for the same. While maintaining the entries in the table, even though I maintain a blank entry for a field it is saving the entry. But, I don't want that way. All the fields are mandatory in my table. One should enter all the fields. Otherwise it should not allow to save the entry. So, I think it can be done using the Table Maintenance Events. can someone tell me how to use the Table Maintenance Events. and which event to use for my reuqirement and what is the logic to be written.
    Or Is there any other way to solve my problem.
    Please share your inputs. Thanks in advance.
    Best regards,
    paddu.

    In the table maintenance generator, Environment --> Modifications --> Events then a screen will be appear here,we need to create the Events.In the EVENTS screen, press new Entries, there give 01(Before Saving the Data in the Database) and give a name(This will become a PERFORM), then click the Editor pushbutton, this will be there at the right side of the entry, then a popup will be appear, you can create an include program, there inside of the include program write ur code.
    Here is documentation for Event 01(Before Saving the Data in the Database )
    Event 01: Before Saving the Data in the Database
    Use
    This event occurs before new, changed or deleted entries are written to the database. Other activities can be performed, for example:
    hidden entry processing
    fill hidden fields
    flag data to be written to hidden tables after the database change.
    To have the changes saved by the central maintenance dialog routines, SY-SUBRC must be set to 0 at the end of the routine.
    Realization
    This event has no standard routine. The following global data is available for the realization of the user routine:
    internal table TOTAL
    field symbols
    field symbols <ACTION> and <ACTION_TEXT>
    <STATUS>-UPD_FLAG
    If internal table data are to be changed before saving, t he changes should be made in both the internal table TOTAL and in the internal table EXTRACT.
    FORM abc.
    DATA: F_INDEX LIKE SY-TABIX. "Index to note the lines found
    LOOP AT TOTAL.
    IF <ACTION> = desired constant.
    READ TABLE EXTRACT WITH KEY <vim_xtotal_key>.
    IF SY-SUBRC EQ 0.
    F_INDEX = SY-TABIX.
    ELSE.
    CLEAR F_INDX.
    ENDIF.
    (make desired changes to the line TOTAL)
    MODIFY TOTAL.
    CHECK F_INDX GT 0.
    EXTRACT = TOTAL.
    MODIFY EXTRACT INDEX F_INDX.
    ENDIF.
    ENDLOOP.
    SY-SUBRC = 0.
    ENDFORM.
    Regards,
    Joy.

  • Using database connection in a servlet and get errors after 8 hours

    Hey,
    I'm running a poker script using applet/servlets and it works great. But for some reason about about 8 hours that database layer stops working. At first I thought it was the connections to mySQL that were timing out (because im using connection pooling) but after turning pooling off (I now create the connection each time) I'm still seeing that same error (I can create a connection but when I do an action ex. like a select statment I get an error). What i'm wondering could it be that the driver I load with Class.forName() some how unloads it's self after x amount of time not being used? Not sure if that is it but if anyone could give me some insight that would be great. The Error i recieve is below:
    INFO: Database Event:DatabaseController: Error executing database query.
    ERROR: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: Software caused connection abort: recv failed
    STACKTRACE:
    java.net.SocketException: Software caused connection abort: recv failed
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(Unknown Source)
         at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:104)
         at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144)
         at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:172)
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1839)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2784)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1183)
         at com.softnet.database.DatabaseController.executeDatabaseQuery(DatabaseController.java:190)
         at com.softnet.games.GameServer.validateUser(GameServer.java:438)
         at com.softnet.games.GameServer.handleData(GameServer.java:113)
         at com.softnet.network.HttpConnectionThread.run(HttpServletListener.java:191)
    ** END NESTED EXCEPTION **
    I know the query is good because it works all other times just not after about 8 hours.
    --Z3r0CooL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hey,
    Thanks for the responces. For the connection pooling I would open 5 connections and keep them open. So i though maybe after 8 hours after not being used they would timeout. Thats why i turned off conection pooling and create a new connection each time. Anyways i'll post the code below incase i made a mistake somewhere.
    package com.softnet.database;
    /************************ DatabaseControler **************************/
    import java.sql.*;
    import java.util.*;
    import com.softnet.database.DatabaseConnectionPool;
    import com.softnet.database.DatabaseSettings;
    public class DatabaseController
    implements DatabaseListener
         //Used to make sure the database driver is loaded
         private boolean databaseDriverState = false;
         //Used to store a database connection
         private Connection databaseConnection = null;
         //If to user connection pooling or not
         private boolean useConnectionPooling = false;
         //Used to hold the connection pool varible
         private DatabaseConnectionPool connectionPool = null;
         //Used to store database settings
         private DatabaseSettings databaseSettings;
         //Used to hold the DatabaseController listeners
         private List databaseControllerListeners = new ArrayList();
         //min number of connections for connection pool
         private int minNumberOfConnections = 1;
         //max number of connections for connection pool -1 is unlimited
         private int maxNumberOfConnections = -1;
         //DatabaseController Constructors
         public DatabaseController(DatabaseSettings databaseSettings)
              this.databaseSettings = databaseSettings;
              databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
         public DatabaseController(DatabaseSettings databaseSettings, boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
              this.databaseSettings = databaseSettings;
              this.useConnectionPooling = useConnectionPooling;
              this.minNumberOfConnections = minNumberOfConnections;
              this.maxNumberOfConnections = maxNumberOfConnections;
              if(useConnectionPooling == true)
                   connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
                   connectionPool.addDatabaseListener(this);
              else
                   databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
         public DatabaseController() {}
         //Database Settings Get/Set
         public DatabaseSettings getDatabaseSettings()
              return databaseSettings;
         public void setDatabaseSettings(DatabaseSettings databaseSettings)
              this.databaseSettings = databaseSettings;
         //Connection Pooling Get/Set
         public boolean getConnectionPooling()
              return useConnectionPooling;
         public void setConnectionPooling(boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
              this.useConnectionPooling = useConnectionPooling;
              this.minNumberOfConnections = minNumberOfConnections;
              this.maxNumberOfConnections = maxNumberOfConnections;
              if(useConnectionPooling == true)
                   if(connectionPool == null)
                        connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
                        connectionPool.addDatabaseListener(this);
              else
                   if(connectionPool != null)
                        connectionPool.destroyConnections();
                        connectionPool.removeDatabaseListener(this);
                        connectionPool = null;
         //Return if there connected
         public boolean isConnected()
              boolean isConnected;
              if(databaseConnection != null)
                   isConnected = true;
              else
                   isConnected = false;
              return isConnected;
         //Used to connect to database or get a connection for the connection pool
         public void connect()
              if(databaseDriverState == false)
                   databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
              //If we dont have a current connection, make one
              if(databaseConnection == null && databaseDriverState == true)
                   if(useConnectionPooling == false)
                        try
                             databaseConnection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
                        catch (SQLException sqle)
                             //Raise event
                             raiseDatabaseEvent("DatabaseController: Error connecting to database. \nERROR: " + sqle.getMessage());
                             databaseConnection = null;
                   else
                        databaseConnection = connectionPool.getConnection();
         //Used to disconnect from the database or give back the connection to the connection pool
         public void disconnect()
              if(databaseConnection != null)
                   if(useConnectionPooling == false)
                        try
                             //Close DB Connection
                             databaseConnection.close();
                        catch(SQLException ignore) {}
                        finally
                             databaseConnection = null;
                   else
                        connectionPool.returnConnection(databaseConnection);
                        databaseConnection = null;
         public ResultSet executeDatabaseQuery(String sSQL)
              ResultSet databaseResult = null;
              if(databaseConnection != null)
                   try
                        Statement databaseStatement = databaseConnection.createStatement();
                        databaseResult = databaseStatement.executeQuery(sSQL);
                   catch(SQLException sqle)
                        //Raise event
                        raiseDatabaseEvent("DatabaseController: Error executing database query.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
              return databaseResult;
         public int executeDatabaseUpdate(String sSQL)
              int rowsAffected = -1;
              if(databaseConnection != null)
                   try
                        Statement databaseStatement = databaseConnection.createStatement();
                        rowsAffected = databaseStatement.executeUpdate(sSQL);
                   catch(SQLException sqle)
                        //Raise event
                        raiseDatabaseEvent("DatabaseController: Error executing database update.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
              return rowsAffected;
         //Used to load the Database Driver
         private boolean loadDatabaseDriver(String databaseDriver)
              boolean driverLoaded;
              if(databaseDriver.equals("") == false)
                   try
                        //Load Database Driver
                        Class.forName(databaseDriver).newInstance();
                        driverLoaded = true;
                   catch (Exception e)
                        //Raise event
                        raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + e.getMessage());
                        driverLoaded = false;
              else
                   driverLoaded = false;
              return driverLoaded;
         //Wrap the DatabaseConnectionPool Error to the DatabaseController
         public void databaseEventOccurred(DatabaseEvent de)
              raiseDatabaseEvent(de.getErrorMessage());
         //Event Handling Code
         //Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
    public synchronized void addDatabaseListener(DatabaseListener databaseControllerListener)
    databaseControllerListeners.add(databaseControllerListener);
    //Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
    public synchronized void removeDatabaseListener(DatabaseListener databaseControllerListener)
    databaseControllerListeners.remove(databaseControllerListener);
    //Used to send the raise event to the listeners
    private synchronized void raiseDatabaseEvent(String databaseError)
    DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
    Iterator listeners = databaseControllerListeners.iterator();
    while(listeners.hasNext())
         DatabaseListener listener = (DatabaseListener) listeners.next();
    listener.databaseEventOccurred(databaseEvent);
    /********************* DatabaseConnectionPool **************/
    package com.softnet.database;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import com.softnet.database.*;
    import com.softnet.database.DatabaseSettings;
    public class DatabaseConnectionPool
         //min number of connections
         private int minNumberOfConnections = 1;
         //max number of connections -1 is unlimited
         private int maxNumberOfConnections = -1;
         //Store the connections
         protected Hashtable databaseConnections = null;
         //Database Info
         protected DatabaseSettings databaseSettings;
         //to hold Driver state
         private boolean databaseDriverState = false;
         //To hold connection checker
         private DatabaseConnectionCheck connectionChecker = null;
         //Used to hold the DatabaseConnectionPool listeners
         private List databaseConnectionPoolListeners = new ArrayList();
         public DatabaseConnectionPool(DatabaseSettings databaseSettings, int minNumberOfConnections, int maxNumberOfConnections)
              this.databaseSettings = databaseSettings;
              this.minNumberOfConnections = minNumberOfConnections;
              this.maxNumberOfConnections = maxNumberOfConnections;
              //Load Driver
              databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
              //Create connection
              createConnections();
         public DatabaseConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
              this.minNumberOfConnections = minNumberOfConnections;
              this.maxNumberOfConnections = maxNumberOfConnections;
         //Database Settings Get/Set
         public DatabaseSettings getDatabaseSettings()
              return databaseSettings;
         public void setDatabaseSettings(DatabaseSettings databaseSettings)
              this.databaseSettings = databaseSettings;
         //Driver State Get
         public boolean getDatabaseDriverState()
              return databaseDriverState;
         public void createConnections()
              if(databaseDriverState == false)
                   databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
              //Create all connections and load the minimum in the Hashtable
              if(databaseConnections == null)
                   if(databaseDriverState == true && minNumberOfConnections != 0)
                        databaseConnections = new Hashtable();
                        for(int i = 0; i < minNumberOfConnections; i++)
                             try
                                  databaseConnections.put(DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword()), Boolean.FALSE);
                             catch(SQLException sqle)
                                  //Problem break loop and destroy any connections
                                  destroyConnections();
                                  //Raise event
                                  raiseDatabaseEvent("DatabaseConnectionPool: Error creating database connections. \nERROR: " + sqle.getMessage());
                                  break;
              //If no connection check exists create one
              if(connectionChecker == null)
                   connectionChecker = new DatabaseConnectionCheck(this);
                   connectionChecker.start();
         public Connection getConnection()
              Connection connection = null;
              boolean errorWithConnection = false;
              Enumeration connections = databaseConnections.keys();
              synchronized (databaseConnections)
                   while(connections.hasMoreElements())
                        errorWithConnection = false;
                        connection = (Connection) connections.nextElement();
                        Boolean state = (Boolean) databaseConnections.get(connection);
                        //If connection is not used, use it.
                        if(state == Boolean.FALSE)
                             try
                                  connection.setAutoCommit(true);
                             catch(SQLException e)
                                  //Problem with connection remove connection and replace it
                                  databaseConnections.remove(connection);
                                  try
                                       connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
                                  catch(SQLException sqle)
                                       errorWithConnection = true;
                             if(errorWithConnection == false)
                                  // Update the Hashtable to show this one's taken
                                  databaseConnections.put(connection, Boolean.TRUE);
                                  // Return the connection
                                  return connection;
                   //All connections being used check to max to see if we can make a new one
                   if(maxNumberOfConnections == -1 || maxNumberOfConnections > databaseConnections.size())
                        try
                             connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
                        catch(SQLException sqle)
                             errorWithConnection = true;
                        if(errorWithConnection == false)
                             databaseConnections.put(connection, Boolean.TRUE);
                             return connection;
              //If not connections free and max connections reached wait for a free connection
              return getConnection();
         public void returnConnection(Connection connection)
              boolean errorWithConnection = false;
              //Make sure connection still works
              try
                   connection.setAutoCommit(true);
              catch(SQLException e)
                   //Problem with connection remove connection and replace it
                   databaseConnections.remove(connection);
                   try
                        connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
                   catch(SQLException sqle)
                        errorWithConnection = true;     
              if(errorWithConnection == false)
                   databaseConnections.put(connection, Boolean.FALSE);
         public void destroyConnections()
              Connection connection = null;
              if(databaseConnections != null)
                   //Close all connections
                   Enumeration connections = databaseConnections.keys();
                   while (connections.hasMoreElements())
                        connection = (Connection) connections.nextElement();
                        try
                             connection.close();
                        catch(SQLException ignore) {}
                   //Free up hashtable
                   databaseConnections = null;
         private boolean loadDatabaseDriver(String databaseDriver)
              boolean driverLoaded;
              if(databaseDriver.equals("") == false)
                   try
                        //Load Database Driver
                        Class.forName(databaseDriver);
                        driverLoaded = true;
                   catch (ClassNotFoundException cnfe)
                        //Raise event
                        raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + cnfe.getMessage());
                        driverLoaded = false;
              else
                   driverLoaded = false;
              return driverLoaded;
         //Event Handling Code
         //Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
    public synchronized void addDatabaseListener(DatabaseListener databaseConnectionPoolListener)
    databaseConnectionPoolListeners.add(databaseConnectionPoolListener);
    //Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
    public synchronized void removeDatabaseListener(DatabaseListener databaseConnectionPoolListener)
    databaseConnectionPoolListeners.remove(databaseConnectionPoolListener);
    //Used to send the raise event to the listeners
    private synchronized void raiseDatabaseEvent(String databaseError)
    DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
    Iterator listeners = databaseConnectionPoolListeners.iterator();
    while(listeners.hasNext())
         DatabaseListener listener = (DatabaseListener) listeners.next();
    listener.databaseEventOccurred(databaseEvent);
    class DatabaseConnectionCheck extends Thread
         private DatabaseConnectionPool connectionPool;
         DatabaseConnectionCheck(DatabaseConnectionPool connectionPool)
              this.connectionPool = connectionPool;
         public void run()
              try
                   while(true)
                        //check threads every 30 seconds
                        this.sleep(300000);
                        if(connectionPool.databaseConnections != null)
                             Connection connection = null;
                             Enumeration connections = connectionPool.databaseConnections.keys();
                             synchronized (connectionPool.databaseConnections)
                                  while(connections.hasMoreElements())
                                       connection = (Connection) connections.nextElement();
                                       Boolean state = (Boolean) connectionPool.databaseConnections.get(connection);
                                       //If connection is not used, use it.
                                       if(state == Boolean.FALSE)
                                            try
                                                 connection.setAutoCommit(true);
                                            catch(SQLException e)
                                                 //Problem with connection remove connection and replace it
                                                 connectionPool.databaseConnections.remove(connection);
                                                 try
                                                      connection = DriverManager.getConnection(connectionPool.databaseSettings.getDatabaseURL(), connectionPool.databaseSettings.getUserName(), connectionPool.databaseSettings.getUserPassword());
                                                 catch(SQLException sqle)
                                                      connection = null;
                                                 // Update the Hashtable with new connection if its not null
                                                 if(connection != null)
                                                      connectionPool.databaseConnections.put(connection, Boolean.FALSE);
              catch(InterruptedException ignored) {}     
    Basicly the why it works is the connection pool hold the database connections. When the user needs a connection they use the database controller to request a connection (By create a instance and called the connect() method) and the connection is either created or grabed from the connection pool. After the user is done with the connection they call the disconnect() method which closes the connection or returns it to the connection pool.
    --Z3r0CooL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

  • Discovery data couldn't be inserted to the database. This could have happened because of one of the following reasons:

    Discovery data couldn't be inserted to the database. This could have happened because  of one of the following reasons:
      - Discovery data is stale. The discovery data is generated by an MP recently deleted.
      - Database connectivity problems or database running out of space.
      - Discovery data received is not valid.
     The following details should help to further diagnose:
     DiscoveryId: ae39d630-f82d-77ee-d5d9-dd4c4a2e7bc2
     HealthServiceId: ab069276-c6dc-13d7-3ef5-28e780c34953
     Microsoft.EnterpriseManagement.Common.DiscoveryDataUnresolvedClassPropertyNameException,Unable to resolve the class property name specified in the discovery data item. Try using a fully qualified name.
    Class property name: 12f3e541-ec4d-7310-be57-fa3bde0bed06
    Rule ID: ae39d630-f82d-77ee-d5d9-dd4c4a2e7bc2
    Instance:
    <?xml version="1.0" encoding="utf-16"?><ClassInstance TypeId="{6ce7ab22-1880-0eb1-40ba-86d9a8c3d5f5}"><Settings><Setting><Name>0b3944af-12ff-1e1f-ac5c-55485fc10671</Name><Value>MANAGED
    REAL TIME APPLY</Value></Setting><Setting><Name>12f3e541-ec4d-7310-be57-fa3bde0bed06</Name><Value>rac2</Value></Setting><Setting><Name>18900065-cbab-1788-0c0e-2c97ef41d7d2</Name><Value>LGWR</Value></Setting><Setting><Name>1a42a2bc-9e87-029a-6db6-f512f8d00ca2</Name><Value></Value></Setting><Setting><Name>5c92d602-346f-9202-e2b4-7cfdc7226661</Name><Value>Common</Value></Setting><Setting><Name>5e763b8d-1979-d0e9-08bf-ea857c67fbaa</Name><Value></Value></Setting><Setting><Name>7dd3b6cb-8180-d58a-fae2-985730c3ffb8</Name><Value></Value></Setting><Setting><Name>7ecb288d-50c8-dd5b-419f-5d4712ef4b75</Name><Value>Database
    Physical</Value></Setting><Setting><Name>8c62b4e5-a737-b8d7-9017-4e8ea4c5a4ac</Name><Value></Value></Setting><Setting><Name>99cdac55-6b00-2485-cb26-bed62d37c926</Name><Value>Common</Value></Setting><Setting><Name>9ed7463c-fa1e-00ea-6743-5e54b928b7e8</Name><Value></Value></Setting><Setting><Name>a606d019-eff4-c6b9-eec9-32d43913fa58</Name><Value>DatabasePhysicalMP</Value></Setting><Setting><Name>aa9fbc8a-e274-91e8-7731-ba324682cab9</Name><Value>DatabasePhysical</Value></Setting><Setting><Name>afb4f9e6-bf48-1737-76ad-c9b3ec325b97</Name><Value>rac2</Value></Setting><Setting><Name>b60a9e0e-5baa-9b0a-8201-6ddd697d060d</Name><Value></Value></Setting><Setting><Name>bf194186-a061-ccf1-94de-971988a79003</Name><Value></Value></Setting><Setting><Name>c2ec02fc-fa4d-65c9-82da-fa76476433eb</Name><Value>rac2</Value></Setting><Setting><Name>d87b0cd0-2149-5736-ab85-42ebddab12a2</Name><Value></Value></Setting><Setting><Name>e1165cbd-8778-5bc1-de07-af341d420068</Name><Value>GRD</Value></Setting><Setting><Name>f56fc436-4a31-48dc-3127-745e5a6d2800</Name><Value></Value></Setting><Setting><Name>fda3d28f-3f34-e51c-e1ad-b1413a70c4ac</Name><Value>GUARD</Value></Setting></Settings></ClassInstance>.

    Try to reimport the MP. You should use the following sql to query the problematic MP
    select d.discoveryid, d.discoveryName,mp.mpfriendlyname from discovery d inner join managementpack mp on d.managementpackid=mp.managementpackid where d.discoveryid='ae39d630-f82d-77ee-d5d9-dd4c4a2e7bc2'
    Discovery data couldn't be inserted to the database: Event IDs: 33333 and 10801
    http://social.technet.microsoft.com/Forums/en-US/operationsmanagergeneral/thread/5f826064-d3f5-43f0-a328-c2f3eb56e932
    Insert Discovery Data Fails
    http://social.technet.microsoft.com/Forums/en-US/operationsmanagerauthoring/thread/8b1387f0-ca4a-480b-a0f0-557d14c3fa89
    Event ID: 10801 in RMS server
    http://social.technet.microsoft.com/forums/en-us/operationsmanagergeneral/thread/5467A6A7-0B26-45C1-BF69-368E5A7AB841
    Roger

Maybe you are looking for