SQL is one of the most popularly used Open Source Database. Applications with front end written in Java technology and back end as SQL makes an excellent combination. Now, to connect front end to database i.e. to connect to SQL database from Java, below is the code snippet:
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@" +
hostIp + ":1521:" + dbName, "username", "password");
- hostIp: Ip address of the machine/system on which database is installed
- dbName: Name of the database
- username: Username required to connect to database
- password: Password required to connect to database
Hope the information presented here helps you in some way. Please leave your queries or suggestions in the comments section below…!!