Wednesday, July 24, 2013

Querying Oracle OID LDAP for the real serivce name and TNS details for JDBC

I have a wonderful cloud instance and a database, however on different segments and somehow dear firewall does not allow me to connect...
jdbc:oracle:thin:@ldap://oidprd.gss.mycompany.com:389/fxgdev65,cn=OracleContext,dc=mycompany,dc=com
At the boot of the weblogic server it sends a warning that the targeted jdbc pool cannot create a connection...
     
How to get the TNS name? Ever heard of curl.... thats the way to go (of course you would need openldap libraries loaded... which on my Mac OSX is the case)
$ curl -0 ldap://oidprd.gss.mycompany.com:389/cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
DN: cn=fxgdev65,cn=OracleContext,dc=mycompany,dc=com
 objectclass: orclNetService
 objectclass: top

 orclnetdescstring: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycompany.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

 cn: fxgdev65
NOTE: you cannot just use the URI definition of the JDBC url, you need to add the cn= before the service you want to lookup So there you go ... now lets put that after the 'at' sign...
jdbc:oracle:thin://(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=fxgdev65.mycom.com)(PORT=1527)))(CONNECT_DATA=(SERVICE_NAME=FXGDEV65.MYCOMPANY.COM)(SRVR=DEDICATED)))

Saturday, July 13, 2013

WebLogic Password Encryption / Recovery

Put this in the startup in the JAVA_OPTIONS
-Dweblogic.system.RemoveBootIdentity=true -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic -Dweblogic.system.StoreBootIdentity=false
$ java -cp /opt/weblogic/wl10.3.2/wlserver_10.3/server/lib/weblogic.jar -Dweblogic.RootDirectory=/opt/my/domain/here -Dweblogic.management.allowPasswordEcho=true weblogic.security.Encrypt Password: MY_PASSWORD

Wednesday, July 3, 2013

Wiring a combo box populating two fields by means of events.

We have a 'citycombo' with store attached that has a record with the name and the state where the city resides. For example: name : 'Springfield', state : 'MA'. The selection of Springfield, MA from the city combo will populate the state field (which is freeform). How to wire the events. Flow; catch the select event, lookup the state field by means of its id 'stateId' and set the value of the field found....
   }, {
     'xtype' : 'citycombo',
     'name' : 'city',
     'fieldLabel' : 'city',
     listeners : {
      "select" : function(k, rs) {
       console.log("%o %o", k, rs);
       if (rs.length) {
        me.getComponent('iState').setValue(rs[0].get('state'));
       }
      }

     },

   }, {
     'xtype' : 'textfield',
     'id' : 'iState',
     'name' : 'state',
     'fieldLabel' : 'state',

   },

Monday, July 1, 2013

Grid - Form and Filtering in ExtJS4 and record release.

Components we have ... [1] one grid - with table of query results [2] one form - for details when row is selected in the grid [3] one check - box The check box 'Incl' will apply a filter based on the checked value. If you selected a record and show it in the form there will be an error occuring on the handler when using the filtering on the store like this.
   }, {
     xtype : 'checkbox',
     boxLabel : 'Incl. Archive',
     handler :  function(_old, _new) {
       var filter = {};
       var _store_ = Ext.getStore('GridStore');
       // release any loaded record bound to form.
       if (!_new) {
        filter = { property : 'my_field', value : { '!=' : 'ARC'}};
        _store_.filter(filter);
       }
       else {
        _store_.clearFilter();
       }
     }
TypeError: record is undefined
createRelayer()ext-all-debug.js (line 11282)
fire()ext-all-debug.js (line 9677)
continueFireEvent(eventName="selectionchange", args=[Object { events={...}, views=[1], modes={...}, more...}, []], bubbles=undefined)ext-all-debug.js (line 11035)
fireEventArgs(eventName="selectionchange", args=[Object { events={...}, views=[1], modes={...}, more...}, []])ext-all-debug.js (line 11013)
fireEvent(eventName="selectionchange")ext-all-debug.js (line 10999)
maybeFireSelectionChange(fireEvent=true)ext-all-debug.js (line 92334)
doDeselect(records=[Object { raw={...}, modified={...}, data={...}, more...}], suppressEvent=undefined)ext-all-debug.js (line 92269)
deselect(records=Object { raw={...}, modified={...}, data={...}, more...}, suppressEvent=undefined)ext-all-debug.js (line 92155)
handler(_old=Object { xtype="checkbox", boxLabel="Incl. Archive", initialConfig={...}, more...}, 
The reason is that the form will "hold" the record that was selected in the grid. To solve this we need to deselect the record, but that's not all. We also need to prevent the 'selectionchange' event from occurring, hence suspending the events on the selection model would also need to be applied. The new handler code for the checkbox is:
     handler :  function(_old, _new) {
       var filter = {};
       var _store_ = Ext.getStore('TerritoryAddressStore');
       // release any loaded record bound to form.
       grid.getSelectionModel().suspendEvents();
       grid.getSelectionModel().deselect(form.getRecord());
       if (!_new) {
        filter = { property : 'my_field', value : { '!=' : 'ARC'}};
        _store_.filter(filter);
       }
       else {
        _store_.clearFilter();
       }
       grid.getSelectionModel().resumeEvents();
      
     }