Announcement

Collapse
No announcement yet.

How to connect MySQL Database from Java?

Collapse

Ads on showthread pages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to connect MySQL Database from Java?

    WordPress Hosting on SSD Servers
    Hello All,

    In order to connect MySQL database with Java one need to use below mentioned sample script:

    <%@ page import="java.sql.*" %>
    <%@ page import="com.mysql.jdbc.Driver" %>

    <%!
    Class.forName("com.mysql.jdbc.Driver").newInstance ();
    java.sql.Connection conn;
    conn = DriverManager.getConnection(
    "jdbc:mysql://<server>/<database>?user=<username>&password=<password>") ;
    %>

    Thanks,

    Shane G.
    AccuWebHosting.Com
Working...
X
Sign up for a News Letter Click here to sign up