Thursday, January 13, 2022

What is Host and Url in JDBC J2EE

What is Host 

Host is a platform on which all the applications can be executed.

Type of Host

There are two different types of host-present namely:-

  a)Local Host     b)Remote(Global) Host


a) Local Host:- In case of localhost, the application is limited to only a particular system.

                     Example: Standalone Application(Desktop Application-like file manager, Calculator ).

b) Remote Host:- In case of a remote host, the application is not restricted or limited to any system.

                    Example:- Any Real-time Application ( Youtube etc).


What is URL?

URL (Uniform Resource Locator)

It is the path or address using which, we can access the resources uniquely over the network.

Constraints of Url are:- Protocol, Host+PortNo, ResourceName.

  • In case of URL, Data refers to key and Value pair provided by the user. ( Servlet )
  • The protocol for the Web Applications:- HTTP(Hypertext Transfer Protocol) / HTTPS(Hypertext Transfer Protocol Secure)
  • The protocol of JDBC is JDBC:sub-protocol(Respective DB Server)

Syntax:- mainprotocol:sub-protocol://Host:PortNo/DB_NAME(Optional)


MySql(DB SERVER):

Local Host:-

                       Host Information              User Information 

            

                     jdbc:mysql://localhost:3306?user=root&password=root 


Remote Host:-

                     jdbc:mysql://192.168.10.16:3306?user=root&password=root


Oracle(DB SERVER):-


Local Host:-

            jdbc:oracle://localhost:1521?user=scott&password=tiger

 

Remote Host:-

                    jdbc:oracle://192.168.10.16:1521?user=scott&password=tiger


Implementation Classes == Driver Classes !!!!!


FQCN(Fully Qualified Class Name)

  •      Package Name.Class Name

Standard Way of creating a package structure:-

  • com/org.company_name.Application_name.


Different Driver Class provided by Respective db server or vendor:-


DB server                 FQCN

---------       --------------------------------------------

 Mysql       :-     com.mysql.jdbc.Driver


 Oracle      :-     oracle.jdbc.driver.OracleDriver


 Ms-sql      :-     com.microsoft.sqlserver.jdbc.SqlServerDriver


 Derby       :-     org.apache.derby.jdbc.EmbeddedDriver


a) All the Driver classes which is a part of JDBC Driver are provided by the respective DB servers or vendors in the form of jar file.

b) All the Driver classes must mandatory implements java.sql.interfaces which is a part of jdbc API.




0 comments:

If you have any doubts,please let me know