WebLogic Server and Oracle Real Application Clusters (RAC)

Oracle Real Application Clusters (RAC) is a software component you can add to a high-availabitlity solution that enables users on multiple machines to access a single database with increased performance. RAC comprises of two or more Oracle databases instances running on tow or more clustered machines and accessing a shared storage device via cluster technology. Oracle RAC offers the following features to applications on WebLogic Server:

    * Scalability: A RAC appears lika a single Oracle database and is maintained using the same tools and practices. All nodes in the cluster execute transactions against the same database. RAC coordinates access to the shared data to ensure consistency, and integrity. Nodes can be added to the cluster without partitioning data (Horizontal scaling).
    * Availability: Depending on the configuration, when a RAC node fails, in-flight transactions are redirected to another node in the cluster either by WebLogic Server or Oracle Thin driver. The fail-over is not for failed connections. Fail-over is only for transactions, which will be driven to completion, based on the time of failure.
    * Load Balancing: BEA supports load balancing capability with Oracle RAC servers, through multi-data sources
    * Failover: BEA recommends using WebLogic JDBC multi data sources to handle failover. Transparent Application Failover is not supported with WebLogic Server due to the requirement of Oracle OCI driver which is not supported by BEA.

Configuration Options
BEA supports several configuration options for using Oracle RAC with WebLogic Server:

   1. Multiple RAC instances with Global Transactions: BEA recommends the use of transaction-aware WebLogic JDBC multi data sources, which support failover and load balancing, to connect to RAC nodes.
   2. Multiple RAC instances without XA transactions: BEA recommends the use of (non-transaction-aware_ multi data sources to connect to the RAC nodes. Use the standard multi data source configuration, which supports failover and load balancing.
   3. Multiple RAC nodes when multi data sources are not an option: Use Oracle RAC with connect-time failover. Load balancing is not supported in this configuration.

Limitations:A detailed explanation of the following limitations can be found on WebLogic site

   1. Since Oracle requires that a Global Transaction must be initiated, prepared, and concluded in the same instance of the RAC cluster, and since Oracle Thin driver cannot guarantee that a transaction is initiated and concluded on the same RAC instance when when the driver is configured for load balancing, you cannot use connect-time load balancing wihen using XA with Oracle RAC.
   2. There is a potential for Inconsistent Transaction Completion
   3. Potential for Data Deadlocks in Some Failure scenarios
   4. Potential for Transactions Completed out of sequence.

WebSphere Application Server V6.1: JMS Problem Determination

This article describes problem determination information for WebSphere Application Server V6.1 JMS application users. It discusses problem diagnosis for JMS applications using the default messaging provider and the WebSphere MQ provider. The paper also includes information for WebSphere Application Server V6.1 on distributed platforms and z/OS. It also takes to diagnose a JMS related problem in a WebSphere Application Server V6.1 environment.
Table of Contents :
Chapter 1. Introduction to JMS problem determination
Chapter 2. Messaging engine problem determination
Chapter 3. Message store problem determination
Chapter 4. Message store with data store persistence
Chapter 5. File store problem determination
Chapter 6. JMS application problem determination
Chapter 7. Messaging in a multiple messaging engine environment
Chapter 8. Clustering problem determination
Chapter 9. Message-driven beans problem determination
Chapter 10. WebSphere MQ and MDBs
Chapter 11. WebSphere MQ Server problem determination
Chapter 12. WebSphere MQ configuration
Chapter 13. WebSphere MQ link problem determination
Chapter 14. JMS application with WebSphere MQ problem determination
Chapter 15. Foreign bus problem determination
Chapter 16. Mediation problem determination
Chapter 17. Default messaging provider security
Chapter 18. The next step
Article on WebSphere Application Server V6.1: JMS Problem Determination

WebSphere Application Server V6: Web Server Plug-In Problem Determination

Hi Guys,I have checked in Internet to find the best articles on  WebSphere Application Server V6: Web Server Plug-In Problem Determination.After checking each and every website i found the below article from redbooks very useful.So i am sharing the link  and the details.Hope this will be helpful for you.

This Article describes the techniques for diagnosing problems that are related to the Web server plug-in for WebSphere Application Server V6, including those resulting from configuration errors. The Web server plug-ins handle communications between a Web server and the Web container in an application server or servers. The Web server plug-in works with six different Web servers. However, this paper concentrates on the IBM HTTP Server and its plug-in. It does not address Web server problems or problems that are related to the application server Web container. 

Tutorial on WebSphere Application Server V6: Web Server Plug-In Problem Determination

How to Resolve Memory Leak Problems in a Websphere? |Memory leak detection and analysis in WebSphere Application Server

There are four common categories of memory usage problems in Java:
  • Java heap memory leaks
  • Heap fragmentation
  • Insufficient memory resources
  • Native memory leaks
The common causes for Java heap memory leaks are:
  • Insertion without deletion into collections
  • Unbounded caches
  • Un-invoked listener methods
  • Infinite loops
  • Too many session objects
  • Poorly written custom data structures.
Memory usage problems due to insufficient memory resources can be caused by:
  • Configuration issues (allocating too little memory for heap).
  • System capacity issues(too little physical memory).
Native memory leaks are memory leaks in non-Java cod, for example:
  • Type-II JDBC drivers
  • fragmentation in the non-heap segment of the Java process's address space.
WebSphere Application Server and higher provides a two-stage solution for detection and analysis of memory leaks
  • In the first stage, a lightweight memory leak detection mechanism running within the production WebSphere Application Server uses inexpensive, universally available Java heap usage statistics to monitor memory usage trends, and provides early notification of memory leaks. An automated heap dump generation facility (available in WebSphere Application Server running on IBM JDKs)generates multiple heap dumps that have been coordinated with sufficient memory leakage to facilitate comparative analysis using MDD4J.
  • The second stagethe Memory Dump Diagnostic for Java (MDD4J) is used to analyze heap dumps outside the production application server
More Information on this Arcticle

How to Open Recycle Bin With Run Command in Windows MS-DOS

You can mess around with it using various windows API's... from VB/.NET/etc

You'll also find the folders in C:\$Recycle.Bin\{}\ or C:\$RECYCLER\{

An alternative way to open Recycle Bin

    * Click on Start and go to Run.
    * Type "::{645FF040-5081-101B-9F08-00AA002F954E}" without quotes.
    * Click OK or press Enter.

Handling Oracle Large Objects with JDBC,LOBs (Large OBjects),Character Large Object (CLOB) and Binary Large Object(BLOB)

LOBs (Large OBjects) are are designed to support large unstructured data such as text, images, video etc. Oracle supports the following two types of LOBs:
  • Character Large Object (CLOB) and Binary Large Object(BLOB) are stored in the database either in-line in the table or in a separate segment or tablespace.
  • BFILEs are large binary data objects stored in operating system files outside of database tablespaces.
Oracle extension classes are provided to support these types objects in JDBC like oracle.sql.CLOB, oracle.sql.BLOB. While you can use java.sql.Blob and java.sql.Clob, oracle extensions provide added functionalities, such as adding bytes specific positions (getBytes(int pos, byte[] data) etc.


Working with LOB Data

CLOB and the BLOB objects are not created and managed in the same way as the ordinary types such as VARCHAR. To work with LOB data, you must first obtain a LOB locator. Then you can read or write LOB data and perform data manipulation. Use the ResultSet's getBlob method to obtain the LOB locator, and then you can obtain the a Stream of the blob to read/write to the Blob
Blob blob = rs.getBlob(1);
InputStream is = blob.getBinaryStream();
OutputStream os = blob.setBinaryStream(1);
The following example shows how to insert, read and write Blobs to Oracle from Java. The table here has only two columns (IMAGE_ID and IMAGE) IMAGE is a BLOB.


package data;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class BlobTest {

 public void insertBlob(String imageId, String fileName) {
   Connection conn = null;
   try {
     conn = getConnection();
     if (!fileName.equals("")) {
       PreparedStatement ps = conn.prepareStatement("INSERT INTO IMAGES VALUES(?, ?)");
       ps.setString(1, imageId);
       FileInputStream fis = new FileInputStream(fileName);
       ps.setBinaryStream(2, fis, fis.available());
       ps.execute();
       ps.close();
     } else {
       PreparedStatement ps = conn.prepareStatement("INSERT INTO IMAGES VALUES (?, empty_blob())");
       ps.setString(1, imageId);
       ps.execute();
       ps.close();

     }
     conn.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }

 public void readBlob(String fileName) {
   Connection conn = null;
   try {
     conn = getConnection();
     Statement st = conn.createStatement();
     ResultSet rs = st.executeQuery("SELECT IMAGE FROM IMAGES");
     while (rs.next()) {
        // The following two lines can be replaced by
        // InputStream is = rs.getBinaryStream(1);
       Blob blob = rs.getBlob(1);
       InputStream is = blob.getBinaryStream();
       FileOutputStream fos = null;

       fos = new FileOutputStream("c:/TEMP/" + fileName);
       byte[] data = new byte[1024];
       int i = 0;
       while ((i = is.read(data)) != -1) {
         fos.write(data, 0, i);
       }
     }
     conn.close();

   } catch (Exception e) {
     e.printStackTrace();
   }
 }

 public void writeBlob(String fileName) {
   Connection conn = null;
   try {
     conn = getConnection();
     Statement st = conn.createStatement();
     ResultSet rs = st.executeQuery("SELECT IMAGE FROM IMAGES FOR UPDATE");
     while (rs.next()) {
       Blob blob = rs.getBlob(1);
       System.out.println(blob);
        OutputStream os = blob.setBinaryStream(1);
       FileInputStream fis = null;
       fis = new FileInputStream("c:/TEMP/" + fileName);
       byte[] data = new byte[1];
       int i;
       while ((i = fis.read(data)) != -1) {
         os.write(data, 0, i);
       }
       os.close();
       break;
     }
     conn.close();

   } catch (Exception e) {
     e.printStackTrace();
   }
 }

 private Connection getConnection() throws ClassNotFoundException, SQLException {
   Class.forName("oracle.jdbc.driver.OracleDriver");
   Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "tiger");
   return conn;
 }

 public static void main(String[] args) {
   BlobTest blobTest = new BlobTest();
   blobTest.insertBlob("img1", "");
   blobTest.writeBlob("2.gif");

 }
}

How to insert image in oracle database using java? |Insert Image In To Oracle Data Base Using Servlet, Jdbc

In this tutorial we will see how to insert data into oracle data base using java program/application.
Prerequisites:
  1. All configuration must me done to connect java
    application to oracle before starting this task. As described in my previous tutorial 'How to connect java application with oracle database'.
Steps: 
1.First start your oracle database and create a table of your choice. eg - create table student (id number(3), name varchar2(30),class number(2),marks number(3));
2. Now open IDE and write down the java code for the application which will connect to the oracle database and enter the data to the specific table.
3. After compilation and execution. You will get data inserted in the database.

Source Code for 'Inserting data into oracle database using java program/application':

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class InsertRecord {

public static void main(String[] args) {

String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String cs="jdbc:odbc:connect_oracle";
String user = "system";
String pwd = "tom";
String sqlstmt="INSERT INTO STUDENT VALUES(1,'Steve',5,70)";
Connection con = null;
Statement st = null;
try
{
Class.forName(driver);
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("Driver loaded");
try
{
con=DriverManager.getConnection(cs,user,pwd);
System.out.println("Connected to the Oracle Database");
st = con.createStatement();//creates a Statement object for sending SQL statements to the database.
int updatecount=st.executeUpdate(sqlstmt);//return either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing
System.out.println(updatecount+" row inserted");
}
catch(Exception e)
{
System.out.println(e);
}
try
{
st.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}//main()
}//class()

How to create a simple JavaScript countdown timer? |A Simple JavaScript Countdown - JavaScript / Java

This JavaScript tutorial shows up the algorithm to make a simple countdown timer on your web pages, only with a few code lines.

<script type="text/javascript">
var millisecs_per_day=86400000
// set countdown time in milliseconds
// put desired day as arguments to Date.UTC
// in the order:
// year, month (remember January is 0), day of month, offset from GMT
// NOTE: we are using the offset because that represents midnight
// (beginning of the day) in a specific timezone
var countdown_time=Date.UTC(2008,7,8,-8);
// get the current time and convert to milliseconds
var now=new Date();
var now_millisecs=now.valueOf();

var day_cnt= Math.ceil(( countdown_time - now_millisecs)/86400000 )

// display the number of days left (or since)
if ( day_cnt > 1 )
{
// multiple days to go
document.write( day_cnt + " days to go")
}
else if ( day_cnt == 1 )
{
// one day to go
document.write( day_cnt + " day to go")
}
else if ( day_cnt == 0 )
{
// it's today
document.write( "today")
}
else if ( day_cnt == -1 )
{
// one day ago
document.write( day_cnt + " day ago")
}
else
{
// multiple days ago
document.write( day_cnt + " days ago")
}
</script>