How to connect to SQL database from Java

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:


  • 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…!!

Leave a Reply to money never enough Cancel reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">