Thursday, February 15, 2024
Monday, February 12, 2024
Sunday, February 11, 2024
Friday, February 9, 2024
Tuesday, August 29, 2023
Tuesday, December 9, 2014
DBNotification
Guys, please find below example of fetching database notification,if any kind of activity like insert or update happen in Db, it will notify you with name of activity happen.
package com.hcl.eam; import java.sql.*; import java.util.*; import oracle.jdbc.*; import oracle.jdbc.dcn.*; import oracle.jdbc.dcn.RowChangeDescription.*; public class SMSExchangeNotification { String URL = "jdbc:oracle:thin:username/password@IPAddress:Port:DbName"; Properties prop; public static void main(String[] argv) { SMSExchangeNotification dcn = new SMSExchangeNotification(); try { dcn.prop = new Properties(); dcn.run(); } catch(Exception e) { e.printStackTrace(); } } void run() throws SQLException { OracleConnection conn = (OracleConnection)DriverManager.getConnection(URL,prop); Properties prop = new Properties(); prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true"); DatabaseChangeRegistration dcr = conn.registerDatabaseChangeNotification(prop); try { dcnListener list = new dcnListener(this); dcr.addListener(list); Statement stmt = conn.createStatement(); ((OracleStatement)stmt).setDatabaseChangeRegistration(dcr); ResultSet rs = stmt.executeQuery("select * from xxeam_dept where 1 = 2"); rs.close(); stmt.close(); } catch(Exception e) { //clean up our registration if(conn != null) conn.unregisterDatabaseChangeNotification(dcr); e.printStackTrace(); } finally { try { conn.close(); } catch(Exception e){ e.printStackTrace(); } } try { Thread.currentThread().join(); } catch (Exception e) { e.printStackTrace(); } finally { OracleConnection conn3 = (OracleConnection)DriverManager.getConnection(URL,prop); conn3.unregisterDatabaseChangeNotification(dcr); conn3.close(); } } } class dcnListener implements DatabaseChangeListener { SMSExchangeNotification dcn; dcnListener(SMSExchangeNotification dem) { dcn = dem; } public void onDatabaseChangeNotification(DatabaseChangeEvent e) { TableChangeDescription[] tc = e.getTableChangeDescription(); for (int i = 0; i < tc.length; i++) { RowChangeDescription[] rcds = tc[i].getRowChangeDescription(); for (int j = 0; j < rcds.length; j++) { System.out.println(rcds[j].getRowOperation() + " " + rcds[j].getRowid().stringValue()); } } synchronized( dcn ){ dcn.notify(); } } }
package com.hcl.eam; import java.sql.*; import java.util.*; import oracle.jdbc.*; import oracle.jdbc.dcn.*; import oracle.jdbc.dcn.RowChangeDescription.*; public class SMSExchangeNotification { String URL = "jdbc:oracle:thin:username/password@IPAddress:Port:DbName"; Properties prop; public static void main(String[] argv) { SMSExchangeNotification dcn = new SMSExchangeNotification(); try { dcn.prop = new Properties(); dcn.run(); } catch(Exception e) { e.printStackTrace(); } } void run() throws SQLException { OracleConnection conn = (OracleConnection)DriverManager.getConnection(URL,prop); Properties prop = new Properties(); prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true"); DatabaseChangeRegistration dcr = conn.registerDatabaseChangeNotification(prop); try { dcnListener list = new dcnListener(this); dcr.addListener(list); Statement stmt = conn.createStatement(); ((OracleStatement)stmt).setDatabaseChangeRegistration(dcr); ResultSet rs = stmt.executeQuery("select * from xxeam_dept where 1 = 2"); rs.close(); stmt.close(); } catch(Exception e) { //clean up our registration if(conn != null) conn.unregisterDatabaseChangeNotification(dcr); e.printStackTrace(); } finally { try { conn.close(); } catch(Exception e){ e.printStackTrace(); } } try { Thread.currentThread().join(); } catch (Exception e) { e.printStackTrace(); } finally { OracleConnection conn3 = (OracleConnection)DriverManager.getConnection(URL,prop); conn3.unregisterDatabaseChangeNotification(dcr); conn3.close(); } } } class dcnListener implements DatabaseChangeListener { SMSExchangeNotification dcn; dcnListener(SMSExchangeNotification dem) { dcn = dem; } public void onDatabaseChangeNotification(DatabaseChangeEvent e) { TableChangeDescription[] tc = e.getTableChangeDescription(); for (int i = 0; i < tc.length; i++) { RowChangeDescription[] rcds = tc[i].getRowChangeDescription(); for (int j = 0; j < rcds.length; j++) { System.out.println(rcds[j].getRowOperation() + " " + rcds[j].getRowid().stringValue()); } } synchronized( dcn ){ dcn.notify(); } } }
Thursday, July 4, 2013
Add MS Exchange Support In Evolution Mail Client
Download Evolution auto update script from give on-line link
Download Evolution-ews-3.2.3
Or you can use
wget http://loginroot.com/scripts/evolution-ews-3.2.3-install.sh chmod +x evolution-ews-3.2.3-install.sh ./evolution-ews-3.2.3-install.shAfter installing all update, you can able to add MS-Exchange Web Service in evolution client. Here you can assign Host Name, OWH URL and that's it. If this is not work, then following given Instruction or Link Follow Link Firstly, need to install all needed packages: $ sudo apt-get install evolution libc6-dev-i386 evolution-data-server-dev pkg-config intltool gtk-3.0 gconf-2.0 libgconf2-dev libedataserver1.2-dev libedataserverui-3.0-dev libebackend1.2-dev libecal1.2-dev libedata-cal1.2-dev libedata-book1.2-dev evolution-dev libtool liblogthread-dev gtk-doc-tools Now download somewhere evolution-ews packet from site: Download Choose version by Your evolution on ubuntu: mine is 3.2.3: $ evolution -v evolution 3.2.3 So I downloaded this one: evolution-ews 2.3.2 extract it and go inside: $ tar -xvf evolution-ews-3.2.3.tar.xz $ cd evolution-ews-3.2.3 edit configure.ac file : 1. add line “AC_CHECK_LIB(gthread-2.0, g_thread_init)” somewhere at the beginning of file, (After AC_CONFIG_HEADERS(config.h)). Ex: AC_PREREQ(2.58) AC_INIT([evolution-ews], [3.2.3], [http://bugzilla.gnome.org/browse.cgi?product=evolution-ews]) AM_INIT_AUTOMAKE([gnu 1.9 dist-xz no-dist-gzip]) AC_CONFIG_SRCDIR(README) AC_CONFIG_HEADERS(config.h) AC_CHECK_LIB(gthread-2.0, g_thread_init) 2. Then, find in file this part:AS_COMPILER_FLAGS(WARNING_FLAGS and add parameters: -Wno-error=deprecated-declarations after -DGSEAL_ENABLE. Ex: AS_COMPILER_FLAGS(WARNING_FLAGS, "-DGSEAL_ENABLE -Wno-error=deprecated-declarations -Wall -Wextra -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Wdeclaration-after-statement -Wno-unused-but-set-variable -Werror-implicit-function-declaration -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wpointer-arith -Wundef -Wwrite-strings -Werror") Then four commands are left: $ autoreconf $ ./configure $ make $ sudo make install And you done with editing stuff. When adding account choose Exchange Web Services (EWS).
Subscribe to:
Posts (Atom)