> Hi,
>
> Can anybody tell me, whether it is possible to
> connect to a database, WITHOUT USING JDBC API?
Yes of course you can. It would be a stupid idea. But you can.
> Its a
> question asked in an interview? I told, NO.
Well you were wrong.
You should have said. Yes but it's stupid.
> "Cotton" answered so confidently, but seemed unable
> to add some explanation. What other possibilities are
> there? How else might it be done?
>
Why is there any more explanation required, the answer is right in front of you.
Do you know what a type 4 JDBC driver is? What do you think it is doing?
It is connecting directly to the database.
Usually through a socket, although this is not always the case.
> I know you can access the databases by executing
> Runtime Processes and interpreting the InputStream.
> Are there better ways?
Yes, as mentioned no third party libraries or drivers are needed. Open the socket (or pipe or whatever) and speak to the database directly.
But again it makes no sense to do this since if you can there is more than likely a type 4 driver available anyway so why re-invent the wheel.