JDBC-ODBC configuration or use DataSource to configure sqlserver although it is convenient from the link layer, but the processing of the result set is difficult to really implement the JDBC2 standard, so you want to be a little "professional, still used
The JDBC of SQLSERVER can be connected by yourself.
Class. forName ("com. microsoft. jdbc. sqlserver. SQLServerDriver ");
Connection conn = DriverManager. getConnection (url, user, password );
However, if you write a url, because ODBC only configures the data source (DataSource in MS system configuration) and DataSource (DataSource registered by jdni Technology in JSP/java ide)
As long as relevant attributes are written, the system will find related links for you. There are few examples in the book to illustrate how to write a complete URL of SQLSERVER. It is actually very simple.
String url = "jdbc: microsoft: sqlserver: // hostName: Port; DatabaseName = pubs ";
Generally, Port is 1433. in fact, what format the url is written into is entirely the interest of developers who implement JDBC. They are not written according to the unified standard. We can only write them according to their interest to use JDBC.
The following is the JDBC of some other databases that are not commonly used. It should be noted that the common JDBC is used in this way. Some JDBC of the same database is implemented by different developers, they may not write like this, but in most cases:
DB2:
String url = "jdbc: db2: // localhost: 5000/sample ";
Informix:
String url =
"Jdbc: informix-sqli: // 123.45.67.89: 1533/testDB: INFORMIXSERVER = myserver;
User = testuser; password = testpassword ";
Sybase:
String url = "jdbc: sybase: TTL: localhost: 5007/tsdata ";
PostgreSQL:
String url = "jdbc: postgresql: // localhost/soft"