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"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.