This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Clarifications on Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Clarifications on Java" Watch "Clarifications on Java" New topic
Author

Clarifications on Java

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

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


When The Going Gets Tougher,The Tougher gets Going
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

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.





SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

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

Joined: Mar 24, 2008
Posts: 3827

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

Joined: Aug 03, 2008
Posts: 9293
    
  17

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
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14117
    
  16

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).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

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
Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
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).


be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14117
    
  16

It's really simple: an application server is a web server which can run web applications on the server (for example servlets).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarifications on Java