Link to home
Start Free TrialLog in
Avatar of jmaruthikumar
jmaruthikumar

asked on

IE vs NN

I am using "sun.jdbc.odbc.JdbcOdbcDriver" for my applet for connecting the database.  This works fine for NN. But not for IE.
For IE I have to use "com.ms.jdbc.odbc.JdbcOdbcDriver" provided by the Microsoft.  Now what extra coding(whether in the html file or applet file)  I have to do if I want my applet works fine for both NN and IE at the same time depending the users browser.
Avatar of Ravindra76
Ravindra76


Hi  jmaruthikumar,

  What ?......................

First forget about NN and IE.

Concentrate on Applets and Databases.

 Are you using  JDBC-ODBC bridge in Applet to connect  to database and it has to be executed in both.

There are four types of  JDBC drivers. Refer this URL

http://java.sun.com/products/jdbc/drivers.html 


JDBC-ODBC drivers come under type 1 driver.
Type 1 and 2 driver are not useful for applets to connect to database.

Type3 and Type 4 allow applets to access database with Zero installation. They won't require Class.forName(":....");


They requirement is presence of classes in client side is must for JDBC-ODBC drivers.

You know that Applets will execute on Client side even though they have came from server.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") -  In NN
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver") -- IN IE

So browser will look for these classes on clinet side.

How are you sure that all the clients running your applets are loaded jdbc-odbc bridge classes in their machine.

At first Class.forName will work onlu You have given unlimittted access to applets. The default Security manager will Throw error if use Class.forName.

The solution is Using Type 3 and Type 4 drivers.

Best of luck.
 






Avatar of jmaruthikumar

ASKER

Hi Ravi,

Thanks for ur suggestion.

But Class.forName("..."); is a must irrespective of the type of driver using, whether it is type 3 or type 4. I used type 4 drivers provided by the third parties with zero-client installation. But those are expensive.(I used trail versions).

By default, Jdbc-Odbc driver won't support networking.(Pl.check the following: http://java.sun.com/products/jdbc/faq.html#5 )
If it want to support, we have to create same DSN(DataSource) on each and every Client machine.  Since IE uses its own JVM it doesn't support Jdbc-Odbc.  

Regards
Maruthi.
Hi jmaruthikumar,

 In Type 3 and 4 , the classes are coming on fly to the applet.
The required classes will now come server instead of client.
Class.forName("..."  classes came from server );

But with JDBC-ODBC the case is different. At first some settings has to be done on client side. They must be present in clinet.
Like type 3 and 4, server won't send the on fly.

My doubt is, How can you make settings if you are using applets on internet?.

That's why jdbc-odbc solution is not suitable.

We won't foce the clinets to make the required settings
Hi jmaruthikumar,

 In Type 3 and 4 , the classes are coming on fly to the applet.
The required classes will now come server instead of client.
Class.forName("..."  classes came from server );

But with JDBC-ODBC the case is different. At first some settings has to be done on client side. They must be present in clinet.
Like type 3 and 4, server won't send the on fly.

My doubt is, How can you make settings if you are using applets on internet?.

That's why jdbc-odbc solution is not suitable.

We won't foce the clinets to make the required settings
Hi Ravi,
I agree with u.  What u said is right.
But I had developed applet for intranet with Jdbc-Odbc(since type 4 is expensive) we have to create DSN on each client machine.  
Now I want to work my applet with something like this:
If the user is using NN
{
   Class.forName("load sun jdbc-odbc driver");
}
else
if the user is uisng IE
{
    Class.forName(" load MS jdbc-obc driver");
}
Is this possible? If yes how?
Hi Ravindra,
If am I right u r a telugu guy.
I have some queries regarding Java.
I want to share them with u.
I too working on Java in a MNC in B'lore(India).
my mail id:jmaruthikumar@hotmail.com
pl. keep in touch
maruthi.
Hi jmaruthikumar,

 You are correct.I was born in Andra pradesh

 To solve your problem we have to see any propery so that
 applet can know from which browser it was loaded.

If we don't know, there is a silly solution. Don't laugh at it

try {

   Class.forName("Load nn driver");
  Class.forName("Load IE driver");

}
catch ( NoClassDefFoundException notfound){

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

}

Any how one driver will be loaded. If another driver isnot present means ignore the exception

Best of luck

ASKER CERTIFIED SOLUTION
Avatar of sameerjoshi
sameerjoshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To be of more use to you here is the link for you to check

http://www.codeguru.com/java/articles/548.shtml


Enjoy....

Na telugu talli......
hey sameerjoshi tu marathi ahes ka?
kutha rahatos?
We are all INDIANS man,I live at Thane,Maharashtra.

Ravindra ,thanx for providing links.
jmaruthikumar : I may have a query for you.I will ask you sometime next week ,shall I mail at that account you provided?

Regards
Amit
Kai mhanta AMit Kularni saheb !!! Kai chaalu aahe??
Well I stay I at California. How are u doing????? I see that you are doing well at this site with your name in top 15 experts.I am really happy to see an Indian in the top.

Sameer,
evijay is also indian.and he is also very good.

ani me kahi saheb nahi ahe mala phakt 11 mahinya cha experience ahe in java.anyway what abt u?if u wanna talk ,mail me at that address amitkulz@hotmail.com