Sunday, April 3, 2011

Alternatives to SQL

A distinction should be made between alternatives to relational query languages and alternatives to SQL. Below are proposed relational alternatives to SQL. See navigational database for alternatives to relational:


.QL - object-oriented Datalog
4D Query Language (4D QL)
Datalog
HTSQL - URL based query method
IBM Business System 12 (IBM BS12) - one of the first fully relational database management systems, introduced in 1982
ISBL
Java Persistence Query Language (JPQL) - The query language used by the Java Persistence API in Java EE5 and Hibernate persistence library
LINQ
Object Query Language
QBE (Query By Example) created by Moshè Zloof, IBM 1977
Quel introduced in 1974 by the U.C. Berkeley Ingres project.
Tutorial D
XQuery

Know About SQL

SQL was developed at IBM by Donald D. Chamberlin and Raymond F. Boyce in the early 1970s. This version, initially called SEQUEL (Structured English Query Language), was designed to manipulate and retrieve data stored in IBM's original quasi-relational database management system, System R, which a group at IBM San Jose Research Laboratory had developed during the 1970s. The acronym SEQUEL was later changed to SQL because "SEQUEL" was a trademark of the UK-based Hawker Siddeley aircraft company.

The first Relational Database Management System (RDBMS) was RDMS, developed at MIT in the early 1970s, soon followed by Ingres, developed in 1974 at U.C. Berkeley. Ingres implemented a query language known as QUEL, which was later supplanted in the marketplace by SQL.

In the late 1970s, Relational Software, Inc. (now Oracle Corporation) saw the potential of the concepts described by Codd, Chamberlin, and Boyce and developed their own SQL-based RDBMS with aspirations of selling it to the U.S. Navy, Central Intelligence Agency, and other U.S. government agencies. In June 1979, Relational Software, Inc. introduced the first commercially available implementation of SQL, Oracle V2 (Version2) for VAX computers. Oracle V2 beat IBM's August release of the System/38 RDBMS to market by a few weeks.[citation needed]

After testing SQL at customer test sites to determine the usefulness and practicality of the system, IBM began developing commercial products based on their System R prototype including System/38, SQL/DS, and DB2, which were commercially available in 1979, 1981, and 1983, respectively.

A Little Bit about Cognos

Cognos was founded in 1969 by Alan Rushforth and Peter Glenister. Michael Potter joined Cognos in 1972. It began as a consulting company for the Canadian federal government and offered its first software product, QUIZ, in 1979. During the Canadian recession in the 1980s, Cognos shifted its focus from consulting to software sales.

In 1995, Ron Zambonini was named CEO and brought new marketing strategies. Cognos grew successful with its business intelligence products for local area networks (LAN), but new Internet technologies had come into the BI industry faster than the company had anticipated. After Cognos issued a notice informing shareholders of a slowdown in growth, many sold their shares, causing prices to fall quickly.

This prompted Cognos to build its web technology through the acquisition of other companies rather than internal research and development. In September 2007, Cognos announced that it would be acquiring Applix. It had previously acquired 4Thought, Relational Matters, LEX2000, Interweave, DecisionStream, NoticeCast, Adaytum, Frango, Databeacon and Celequest, an operational intelligence company.

Sunday, March 6, 2011

Java - Null pointers

Null pointers are one of the most common errors that Java programmers make. Compilers can't check this one for you - it will only surface at runtime, and if you don't discover it, your users certainly will.

When an attempt to access an object is made, and the reference to that object is null, a NullPointerException will be thrown. The cause of null pointers can be varied, but generally it means that either you haven't initialized an object, or you haven't checked the return value of a function.

Many functions return null to indicate an error condition - but unless you check your return values, you'll never know what's happening. Since the cause is an error condition, normal testing may not pick it up - which means that your users will end up discovering the problem for you. If the API function indicates that null may be returned, be sure to check this before using the object reference!

Another cause is where your initialization has been sloppy, or where it is conditional. For example, examine the following code, and see if you can spot the problem.

public static void main(String args[])
{
// Accept up to 3 parameters
String[] list = new String[3];

int index = 0;

while ( (index < args.length) && ( index < 3 ) )
{
list[index++] = args[index];
}

// Check all the parameters
for (int i = 0; i < list.length; i++)
{
if (list[i].equals "-help")
{
// .........
}
else
if (list[i].equals "-cp")
{
// .........
}
// else .....
}
}

This code (while a contrived example), shows a common mistake. Under some circumstances, where the user enters three or more parameters, the code will run fine. If no parameters are entered, you'll get a NullPointerException at runtime. Sometimes your variables (the array of strings) will be initialized, and other times they won't. One easy solution is to check BEFORE you attempt to access a variable in an array that it is not equal to null.

Java - Did You Forgetting that Java is zero-indexed

If you've come from a C/C++ background, you may not find this quite as much a problem as those who have used other languages. In Java, arrays are zero-indexed, meaning that the first element's index is actually 0. Confused? Let's look at a quick example.

// Create an array of three strings
String[] strArray = new String[3];

// First element's index is actually 0
strArray[0] = "First string";

// Second element's index is actually 1
strArray[1] = "Second string";

// Final element's index is actually 2
strArray[2] = "Third and final string";

In this example, we have an array of three strings, but to access elements of the array we actually subtract one. Now, if we were to try and access strArray[3], we'd be accessing the fourth element. This will case an ArrayOutOfBoundsException to be thrown - the most obvious sign of forgetting the zero-indexing rule.

Other areas where zero-indexing can get you into trouble is with strings. Suppose you wanted to get a character at a particular offset within a string. Using the String.charAt(int) function you can look this information up - but under Java, the String class is also zero-indexed. That means than the first character is at offset 0, and second at offset 1. You can run into some very frustrating problems unless you are aware of this - particularly if you write applications with heavy string processing. You can be working on the wrong character, and also throw exceptions at run-time. Just like the ArrayOutOfBoundsException, there is a string equivalent. Accessing beyond the bounds of a String will cause a StringIndexOutOfBoundsException to be thrown, as demonstrated by this example.

public class StrDemo
{
public static void main (String args[])
{
String abc = "abc";

System.out.println ("Char at offset 0 : " + abc.charAt(0) );
System.out.println ("Char at offset 1 : " + abc.charAt(1) );
System.out.println ("Char at offset 2 : " + abc.charAt(2) );

// This line should throw a StringIndexOutOfBoundsException
System.out.println ("Char at offset 3 : " + abc.charAt(3) );
}
}

Note too, that zero-indexing doesn't just apply to arrays, or to Strings. Other parts of Java are also indexed, but not always consistently. The java.util.Date, and java.util.Calendar classes start their months with 0, but days start normally with 1. This problem is demonstrated by the following application.

import java.util.Date;
import java.util.Calendar;

public class ZeroIndexedDate
{
public static void main (String args[])
{
// Get today's date
Date today = new Date();

// Print return value of getMonth
System.out.println ("Date.getMonth() returns : " +
today.getMonth());

// Get today's date using a Calendar
Calendar rightNow = Calendar.getInstance();

// Print return value of get ( Calendar.MONTH )
System.out.println ("Calendar.get (month) returns : " +
rightNow.get ( Calendar.MONTH ));
        }
}

Zero-indexing is only a problem if you don't realize that its occurring. If you think you're running into a problem, always consult your API documentation.

Java - How to Write blank exception handlers

I know it's very tempting to write blank exception handlers, and to just ignore errors. But if you run into problems, and haven't written any error messages, it becomes almost impossible to find out the cause of the error. Even the simplest exception handler can be of benefit. For example, put a try { .. } catch Exception around your code, to catch ANY type of exception, and print out the message. You don't need to write a custom handler for every exception (though this is still good programming practice). Don't ever leave it blank, or you won't know what's happening.

For example

public static void main(String args[])
{
try {
// Your code goes here..
}
catch (Exception e)
{
System.out.println ("Err - " + e );
}
}

Java - Comparing two objects ( == instead of .equals)

When we use the == operator, we are actually comparing two object references, to see if they point to the same object. We cannot compare, for example, two strings for equality, using the == operator. We must instead use the .equals method, which is a method inherited by all classes from java.lang.Object.

Here's the correct way to compare two strings.

String abc = "abc"; String def = "def";

// Bad way
if ( (abc + def) == "abcdef" )
{
......
}
// Good way
if ( (abc + def).equals("abcdef") )
{
.....
}

Java - Mistyping the name of a method when overriding

Overriding allows programmers to replace a method's implementation with new code. Overriding is a handy feature, and most OO programmers make heavy use of it. If you use the AWT 1.1 event handling model, you'll often override listener implementations to provide custom functionality. One easy trap to fall into with overriding, is to mistype the method name. If you mistype the name, you're no longer overriding a method - you're creating an entirely new method, but with the same parameter and return type.

public class MyWindowListener extends WindowAdapter {
// This should be WindowClosed
public void WindowClose(WindowEvent e) {
// Exit when user closes window
System.exit(0);
}
});

Compilers won't pick up on this one, and the problem can be quite frustrating to detect. In the past, I've looked at a method, believed that it was being called, and taken ages to spot the problem. The symptom of this error will be that your code isn't being called, or you think the method has skipped over its code. The only way to ever be certain is to add a println statement, to record a message in a log file, or to use good trace debugger (like Visual J++ or Borland JBuilder) and step through line by line. If your method still isn't being called, then it's likely you've mistyped the name.

Java - Mistyping the name of a method when overriding

Overriding allows programmers to replace a method's implementation with new code. Overriding is a handy feature, and most OO programmers make heavy use of it. If you use the AWT 1.1 event handling model, you'll often override listener implementations to provide custom functionality. One easy trap to fall into with overriding, is to mistype the method name. If you mistype the name, you're no longer overriding a method - you're creating an entirely new method, but with the same parameter and return type.

public class MyWindowListener extends WindowAdapter {
// This should be WindowClosed
public void WindowClose(WindowEvent e) {
// Exit when user closes window
System.exit(0);
}
});

Compilers won't pick up on this one, and the problem can be quite frustrating to detect. In the past, I've looked at a method, believed that it was being called, and taken ages to spot the problem. The symptom of this error will be that your code isn't being called, or you think the method has skipped over its code. The only way to ever be certain is to add a println statement, to record a message in a log file, or to use good trace debugger (like Visual J++ or Borland JBuilder) and step through line by line. If your method still isn't being called, then it's likely you've mistyped the name.

Java - Accessing non-static member variables from static methods (such as main)

Many programmers, particularly when first introduced to Java, have problems with accessing member variables from their main method. The method signature for main is marked static - meaning that we don't need to create an instance of the class to invoke the main method. For example, a Java Virtual Machine (JVM) could call the class MyApplication like this :-

MyApplication.main ( command_line_args );

This means, however, that there isn't an instance of MyApplication - it doesn't have any member variables to access! Take for example the following application, which will generate a compiler error message.

public class StaticDemo
{
public String my_member_variable = "somedata";
        public static void main (String args[])
{
// Access a non-static member from static method
System.out.println ("This generates a compiler error" +
my_member_variable );
}
}

If you want to access its member variables from a non-static method (like main), you must create an instance of the object. Here's a simple example of how to correctly write code to access non-static member variables, by first creating an instance of the object.

public class NonStaticDemo
{
public String my_member_variable = "somedata";

public static void main (String args[])
{
NonStaticDemo demo = new NonStaticDemo();

// Access member variable of demo
System.out.println ("This WON'T generate an error" +
demo.my_member_variable );
}
}

Sunday, December 5, 2010

Import Relational Source & Target Definitions

To import a relational source definition:

  1. In the Source Analyzer, click Sources > Import from Database.

  2. Select the ODBC data source used to connect to the source database.
  3. If you need to create or modify an ODBC data source, click the Browse button to open the ODBC Administrator. Create the data source, and click OK. Select the new ODBC data source.
  4. Enter a database user name and password to connect to the database.
  5. Note: The user name must have the appropriate database permissions to view the object.

    You may need to specify the owner name for database objects you want to use as sources.
  6. Click Connect.
  7. If no table names appear or if the table you want to import does not appear, click All.
  • Scroll down through the list of sources to find the source you want to import. Select the relational object or objects you want to import.
  • You can hold down the Shift key to select a block of sources within one folder, or hold down the Ctrl key to make non-consecutive selections within a folder. You can also select all tables within a folder by selecting the folder and clicking Select All. Use the Select None button to clear all highlighted selections.
  • Click OK.
  • The source definition appears in the Source Analyzer. In the Navigator, the new source definition appears in the Sources node of the active repository folder, under the source database name.
  • Click Repository > Save.
  • How to remove Duplicates of records using Informatica?

    Lets say you have 2 columns in source table. Do the following in an expression:

    A(in)
    B(in)
    A_Pre(V) = A
    B_Pre(V) = B
    Comp(V) = IIF( A= A_Pre and B= B_Pre, ‘Y’,'N’)
    Basically you need to store the previous values in a variable and compare with incoming data.

    Router Scenario in Informatica

    Router Scenario:

    Lets say i have more then have record in source table and i have 3 destination table A,B,C. I have to insert first 1 to 10 record in A then 11 to 20 in B and 21 to 30 in C.
    Then again from 31 to 40 in A, 41 to 50 in B and 51 to 60 in C……So on upto last record.

    Solution:

    Generate sequence number using informatica, add filter or router transformations and define the conditions accordingly…

    Define group condition as follows under router groups….

    Group1 = mod(seq_number,30) >= 1 and mod(seq_number,30) <= 10
    Group2 = mod(seq_number,30) >= 11 and mod(seq_number,30) <= 20
    Group3 = (mod(seq_number,30) >=21 and mod(seq_number,30) <= 29 ) or mod(seq_number,30) = 0

    Connect Group1 to A, Group2 to B and Group3 to C

    What is Domain Configuration in Informatica?

    Domain Configuration:

    Domain Configuration Some of the configurations for a domain involves assigning host name, port numbers to the nodes, setting up Resilience Timeout values, providing connection information of metadata Database, SMTP details etc. All the Configuration information for a domain is stored in a set of relational database tables within the repository. Some of the global properties that are applicable for Application Services like ‘Maximum Restart Attempts’, ‘Dispatch Mode’ as ‘Round Robin’/’Metric Based’/’Adaptive’ etc are configured under Domain Configuration

    Informatica Power Center 8.6 Architecture and Installation Steps


    Pre-Requisites:Installtion need atleast 2GB temp space .

    Need 16K default page tablespace for domain creation.

    1)First Install domain and create domain tables.

    2)Now Define domain name and assign nodes

    3)In PowerCenter Administrator console you have to create repository service.

    4)Now Create repository (or upgrade repository)

    5)In the Power Center Administrator console you have to create Integration service.

    6)In the Powe rCenter Administrator console you have to create Metadata service.

    7)Also Create Data profiling warehouse table in Data Profiling schema.

    8)In PowerCenter Administrator console you have to create Reporting service.

    9)In reporting service you have to create data analyzer repository in Data Analyzer schema.

    To Start the Service

    ../server/tomcat/bin/infaservice.sh startup

    Installation Error-Informatica 8.6 in windows server 2008

    Hello All,
    Does Informatica 8.6 is compatible with windows server 2008 OS , i am getting the below error message when i am trying to install to it, can anyone help me out to resolve this, appreciate your time.

    Kindly provide me the list of powercenter editions and itz compatibity info against all Windows OS versions

    Error Message:
    cannot start Informatica Services. Use the error below and catalina.out and node.log in the server/tomcat/logs directory on the current machine to get more information. Select Retry to continue the installation.
    EXIT CODE: S

    Info:

    OS-Win Server 2008

    DB-ORCLE 10G XE

    INFA Edition- PC 8.6