JDBC Connection in Java

Connecting to the Postgres Database

jdbc:postgresql://host:port/database

Connecting to the MySQL Database

 jdbc:mysql://host:port/database 

Connecting to the Oracle Database

jdbc:oracle:thin:@host:port:database

To connect, you need to get a Connection instance from JDBC. To do this, you use the DriverManager.getConnection() method:

Connection db = DriverManager.getConnection(url, username, password)
Advertisements
JDBC Connection in Java

3 thoughts on “JDBC Connection in Java

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s