Found the answer: it is because the vendor specific API implements the Statement and Connection Interfaces and the returning object we are storing in reference of an Interface.
e.g.
interface B{
}
class A implements B{
}
class X{
B ob = new A();
}
This case is implemented in all vendor specific APIs.