Connection conn = drivermanager.getconnection ("Jdbc:odbc:bbs");
This is the phrase that JDBC connects to the database, connection is an interface, DriverManager is a class, and the Getconnection () method is a static method
The reason they can connect with the = number
Because the getconnection () method returns an instance of a class that implements the connection interface
In fact, connection is a class or interface, and under normal circumstances a variable is declared with a class,
And the interface is a specialized class, which is equivalent to the virtual base class in C + +, as long as the class implements this interface is equivalent to inherit the interface
And like a parent class variable = An instance of a subclass is common in Java, and since that's OK
So like an interface variable = An instance of a subclass can also be a row
The Getconnection () method is a static method
Class . Method () This form of method-----class method, i.e., this method can be used even if the class is not instantiated,
There are also objects. Static methods ()
And the general method can not
A factory model is a class that is called a class factory to produce instances of classes (more interfaces)
And this factory class usually has only one copy.
Connection conn = drivermanager.getconnection("");
There is no instantiation of the factory class here, only one copy
Returns an instance of a class that implements the connection interface with a static method class
Purpose---to make use of connection instances, there is no need to care about how classes of connection interfaces change
Connection conn = drivermanager.getconnection ("Jdbc:odbc:bbs");