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 ";