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).
Monday, March 18, 2013
DNS Lookup Error @Browser
DNS Issue Resolution
1. Open the terminal and type host google.com which should print its IP address
2. If that works its likely to be a browser configuration/proxy/etc related problem.
3. If that doesn't work, run cat /etc/resolve.conf and make sure there's at least one line that starts with nameserver and it sollowed by an IP address
4. If there's no line like this, either your resolveconf is misconfigured, or your DHCP server doesn't offer the DNS resolvers.
5. If there is a nameserver x.x.x.x try querying that resolver with host google.com x.x.x.x and if it fails try the Google DNS:host google.com 8.8.8.8
I assuem you have your interface configured, so that you have a default route and you can communicate with it.
Monday, February 25, 2013
Configure Evolution mail client in Linux
Guy's Please find video for Configure Evolution mail client in Linux.
Please find this video and configure evolution mail client accordingly. I have added some dummy smtp and pop setting for reference only. I hope this will help you.
Saturday, February 23, 2013
Linux Command Line Tricks
How to kill all similar processes with single command (in this case opmn)
ps -ef | grep opmn |grep -v grep | awk ‘{print $2}’ |xargs -i kill -9 {}
Locating Files under a particular directory
find . -print |grep -i test.sql
Using AWK in UNIX
To remove a specific column of output from a UNIX command – for example to determine the UNIX process Ids for all Oracle processes on server (second column)
ps -ef |grep -i oracle |awk '{ print $2 }'
Changing the standard prompt for Oracle Users
Edit the .profile for the oracle user
PS1="`hostname`*$ORACLE_SID:$PWD>"
Display top 10 CPU consumers using the ps command
/usr/ucb/ps auxgw | head -11
Show number of active Oracle dedicated connection users for a particular ORACLE_SID
ps -ef | grep $ORACLE_SID|grep -v grep|grep -v ora_|wc -l
Display the number of CPU’s in Solaris
psrinfo -v | grep "Status of processor"|wc -l
Display the number of CPU’s in AIX
lsdev -C | grep Process|wc -l
Display RAM Memory size on Solaris
prtconf |grep -i mem
Display RAM memory size on AIX
First determine name of memory device
lsdev -C |grep mem
then assuming the name of the memory device is ‘mem0’
lsattr -El mem0
Swap space allocation and usage
Solaris : swap -s or swap -l Aix : lsps -a
Total number of semaphores held by all instances on server
ipcs -as | awk '{sum += $9} END {print sum}'
View allocated RAM memory segments
ipcs -pmb
Manually deallocate shared memeory segments
ipcrm -m '<ID>'
Show mount points for a disk in AIX
lspv -l hdisk13
Display amount of occupied space (in KB) for a file or collection of files in a directory or sub-directory
du -ks * | sort -n| tail
Display total file space in a directory
du -ks .
Cleanup any unwanted trace files more than seven days old
find . *.trc -mtime +7 -exec rm {} \;
Locate Oracle files that contain certain strings
find . -print | xargs grep rollback
Locate recently created UNIX files (in the past one day)
find . -mtime -1 -print
Finding large files on the server (more than 100MB in size)
find . -size +102400 -print
Subscribe to:
Posts (Atom)