Common JDBC connection string and jdbc database string

Source: Internet
Author: User

Common JDBC connection string and jdbc database string

1. Mysql

Driver Class: com. mysql. jdbc. Driver

Connection string: jdbc: mysql: // localhost: 3306/dbname

2. Oracle

Driver: oracle. jdbc. driver. OracleDriver

Connection string: jdbc: oracle: thin: @ localhost: 1521: dbname

3. Sqlserver

Driver: com. microsoft. jdbc. sqlserver. SQLServerDriver

Connection string: jdbc: microsoft: sqlserver: // localhost: 1433; DatabaseName = dbnm

4. Access

Class. forName ("sun. jdbc. odbc. JdbcOdbcDriver ");

Connection conn = DriverManager. getConnection ("jdbc: odbc: driver = {Microsoft Access Driver (*. mdb)}; DBQ = C: \ db. mdb ", username, password );

5. jdbc-odbc

Driver: sun. jdbc. odbc. JdbcOdbcDriver

Connection string: jdbc: odbc: dsnname

 


What are the strings defined above when jdbc is used to connect to mysql?

I will not talk about username password. The driver is the mysql driver class specified. the localhost in the url is the IP address of your mysql server, so localhost is used here, the following 3306 is the port of the mysql server, mydb is the name of the connected database, and jdbc: mysql: is equivalent to the http at the front of the website, that is, protocol pull

What are the differences between the connection strings of SQL server and oracle and mysql in java?

Create database link database connection name connect to user name identified by password USING 'database connection string'; the DATABASE connection string can be NET8 easy config or directly modified in TNSNAMES. ORA.

When the database parameter global_name = true, the Database Link name must be the same as the remote database name.

The connection string for java connection to SQL server is Class. forName ("com. microsoft. sqlserver. jdbc. SQLServerDriver "); String url =" jdbc: sqlserver: // localhost: 1433; database = database name; user = username; password = password ";

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.