T4CConnection cannot be cast to a OracleConnection

Leave a comment

Very Simple

(1) Your WAR should not contain odbcX.jar file within classes or lib directory

(2) Add odbcX.jar file to tomcat’s common/lib

 

Cheers

 

Conversion between two timezone in Oracle

Leave a comment

Procedure demonstrate how to convert time between two timezone.


DECLARE
 v_operator varchar2(1) ;
 v_hours number(2);
 v_min number(2);
 v_total_min number(4);
 v_datetime varchar2(128);
 v_sessiondatetime varchar2(128);
 BEGIN

select substr(tz_offset( sessiontimezone ),0,1) INTO v_operator from dual;

select to_number(substr(tz_offset( sessiontimezone ),2,2)) INTO v_hours from dual;

select to_number(substr(tz_offset( sessiontimezone ),5,2)) INTO v_min from dual;

v_total_min := v_hours * 60 + v_min;

if v_operator = '+' then
 select to_char(sysdate - (.000694 *v_total_min ) , 'HH24:MI') into v_datetime from dual;
 else
 select to_char(sysdate +  (.000694 *v_total_min ), 'HH24:MI') into v_datetime from dual;
 end if;
 select to_char(sysdate, 'HH24:MI') into v_sessiondatetime from dual;

dbms_output.put_line(v_sessiondatetime );
 dbms_output.put_line(v_datetime);

END;

This is very simple example, you can use this as a reference to complete your needs.

Cheers

Introduction to Design Pattern

Leave a comment

Hi All,
This is my first blog. In this blog I will give you introduction about design pattern that we are normally follow our day-to-day development life. Learning design patterns is good for people to communicate each other effectively. In fact, you may have been familiar with some design patterns, you may not use well-known names to describe them.  Please make yourself  be familiar with these terms and learn how other people solve the code problems.

Design

Here DESIGN is not pointing to some UI desing, But Desing is all about:

  • How effeciently you are writing your code?
  • How beautiful and resusable your code in other application without or applying very less changes?

If a problem occurs over and over again, a solution to that problem has been used effectively. That solution is described as a pattern. The design patterns are language-independent strategies for solving common object-oriented design problems. When you make a design, you should know the names of some common solutions.

Confusing Point Design V/s Architecture

Architecture defines a flow of your entire application including H/w configuration required on live environment, performance matrix, technology stack etc. Its specify End-to-End flow.
While in other hand Design is only talking about beauty of your code. It is fully attached with your code.

There are some populer solutions to coding some common problem. Such solutions are tried and tested by some experienced and professional programmers known as Design Patterns

In Simple words we can define Design Patterns as:
“Design patterns constitute a set of rules describing how to accomplish certain tasks in the realm of software development.”

Design patterns are not just about the design of objects, but about the communication between objects. Design pattern is discovered by GoF (Gang Of Four–four pioneer guys who wrote a book named “Design Patterns”- Elements of Reusable Object-Oriented Software) programmers

How many Design patterns we have to learn?

Now, this is very big problem. Threre are hundreds of design patterns available including poor coding practice. But, according to GoF we follow 23+ patterns which are very familiar.

Design patterns are categorised based on their behaviour and use.

  1. Creational
  2. Structural
  3. Behavioural

We will discuss each category in-depth.

So, thank you very much friends for reading my blog. In next blog we will discuss more about design pattern.

Till than, ENJOY CODING!.

References

Design Patterns — Elements of Reusable Object-Oriented Software by GOF.

The Design Patterns, Java Companion — by James W. Cooper

Sun’s core J2EE Patterns

Java Camp