Jdbc url format customization and jdbcurl Customization
Database URL formulation:
When the driver is loaded, you can establish a connection using the DriverManager. getConnection () method in the program. For reference, three overload DriverManager. getConnection () methods are listed:
GetConnection (String url)
GetConnection (String url, Properties prop)
GetConnection (String url, String user, String password)
Here, each form requires a database URL. The Database URL directs to the database address.
A database URL is mostly used to establish connections.
The following table lists the popular JDBC driver names and database URLs.
RDBMS |
JDBC driver name |
URL format |
MySQL |
Com. mysql. jdbc. Driver |
Jdbc: mysql ://Hostname/databaseName |
ORACLE |
Oracle. jdbc. driver. OracleDriver |
Jdbc: oracle: thin :@Hostname: port Number: databaseName |
DB2 |
COM.ibm.db2.jdbc.net. DB2Driver |
Jdbc: db2:Hostname: port Number/databaseName |
Sybase |
Com. sybase. jdbc. SybDriver |
Jdbc: sybase: Tds:Hostname: port Number/databaseName |
All highlighted parts in URL format are static, and only the remaining parts need to be changed according to the database settings.
Source: http://www.yiibai.com/jdbc/jdbc-db-connections.html