»

Nov 19

Connecting a database in java

[code language="java"]</code>

<code>
import java.sql.*;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://yourdatabasehost/Databasename","username","password");
</code>

[/code]

You should download jdbc driver (just google it you will find. It's not an application it is . you should build path to the downloaded jar file. It looks complex but very easy. Feel free to comment. watch the below video.

2 comments

  1. Naseer

    very good stuff,thanq

  2. admin

    Thanks

Leave a 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> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>