• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarifications on Java

 
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have few Java Clarifications.Please guide me ....

1> Difference between Application Server and Web Server?

2> What is the difference between using
ArrayList list = new ArrayList(); and List list = new ArrayList();
Which one is better to use and Why?

3> Which is the driver which we use for JDBC
a>JDBC-ODBC bridge(Type 1 Driver)
b>Native API,Partly Java(Type 2 Driver)
c>Net Protocol,Fully Java(Type 3 Driver)
d>Native Protocol,Fully Java(Type 4 Driver)

Please help me out with the answers.

--
Deepak Lal
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Difference between Application Server and Web Server?



Well as far as I know, a servlet container is a web Server. For example Apache Tomcat. And an application server is a complete Java EE server like jBoss which supports EJB etc.

2> What is the difference between using
ArrayList list = new ArrayList(); and List list = new ArrayList();
Which one is better to use and Why?



Well when you use

ArrayList list = new ArrayList();

Then you are binding yourself to a specific implementation. But if you use

List list = new ArrayList();

Then you are using an interface to i.e. you are coding to an interface. In the latter case you get more flexibility. Lemme give you an example of when the latter might be useful. Suppose you have this code



Now suppose later on you decide that ArrayList is not suitable for your requirement as you need fast insertion and deletion. So you decide to use LinkedList. Now you will have to change the whole code



But if you code like this



Now if you decide to change ArrayList to LinkedList, then it will be easy

 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Lal wrote:
2> What is the difference between using
ArrayList list = new ArrayList(); and List list = new ArrayList();
Which one is better to use and Why?



Second approach is the way to go as you are coding to interface rather than to a specific implementation, later you can change to a different implementation without having to change other parts which uses the list reference.




 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

3> Which is the driver which we use for JDBC
a>JDBC-ODBC bridge(Type 1 Driver)
b>Native API,Partly Java(Type 2 Driver)
c>Net Protocol,Fully Java(Type 3 Driver)
d>Native Protocol,Fully Java(Type 4 Driver)



I think you are missing something here. What is the database that you are using. If you are using MS SQL and configuring your connection in Administrative Tools in Windows, then it is Type 1 Driver. If any other, than it depends on the database software and the driver that you use.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:

Difference between Application Server and Web Server?



Well as far as I know, a servlet container is a web Server. For example Apache Tomcat. And an application server is a complete Java EE server like jBoss which supports EJB etc.



Well a servlet container is a Web Container not a Web Server. Web Servers are for serving static content (like html) like Apache Web Server.
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote:Well a servlet container is a Web Container not a Web Server. Web Servers are for serving static content (like html) like Apache Web Server.



Hmm. Minute difference but still I didn't new it
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1> Difference between Application Server and Web Server?


See WebVsApplicationServer in our FAQ.

3> Which is the driver which we use for JDBC


That depends on what you need. The JDBC-ODBC bridge driver from Sun is not really meant for serious applications. A type 3 or 4 driver is usually good, because you don't need any special software on the client PC (for example, you won't need Oracle client software).
 
Deepak Lal
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
Thanks for your valuable inputs and answers which helped me to understand the concepts.

1> I need the differences between Web Server and Application Server ?

@Jesper Young,Thanks for the FAQ,but im not able to figure out the differences clearly.Could you please provide me some differences.I'm confused with the FAQ.

3> So i can conclude that either type 3 or type 4 driver is used for JDBC with the database being oracle 9i.

--
Deepak Lal
 
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the difference between a web Server and Application Server?

A web servers main role is to handle requests from the web (predominantly http and https over TCP / IP) and provide appropriate responses. Its a common client-server pattern. An application Server may also be configured to do this, but more commonly it is used in the middle tier (think J2EE) to handle the business logic between the front end (e.g. a Web server) and the Back End (e.g. a database server). There are a vast number of protocols that can be used within an application server that are not necessarily used (nor available) to an web-server. Examples of Application Servers are GlassFish, (has built in WebServer capability) and WebSphere.

Tomcat is a Web Server of sorts, but mainly a Servlet Container. However, it may also be used as an add-in to other Web servers to Enable Servlet usage (For example Apache).
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's really simple: an application server is a web server which can run web applications on the server (for example servlets).
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic