hai
i am nireekshan;
i am using Mysql 5.0;
it was instaling C:\Program Files\MySQL;
i am write code Bellow see and
--save c:\ "Mysqlcon.java " in this program
run-in commend Fromt> javac Mysqlcon.java It was NOT Any Errer;
>java Mysqlcon
ERRER ACCERED.......CLASS NOT FOUND EXPATION


//I AM COPY Mysql.jar file in C:\

import java.sql.*;

public class Mysqlcon{
  public static void main(String[] args) 
	  {
    System.out.println("MySQL Connect Example.");
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
      String driver = "com.mysql.jdbc.Driver";
    String userName = ""; 
    String password = "";
    try {
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url,userName,password);
      System.out.println("Connected to the database");
      conn.close();
      System.out.println("Disconnected from database");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

@nireekshan - your post is moved to Java section of forum

@na33n and others - if you find post to be in wrong section of the forum, just click on Flag Bad Post and type something like Please move this post to Java forum for example and moderators will deal with it

Thank you

Okay ! I thought flag bad post was to notify the moderators that the post has violated the rules. Thanks for clarifying !

Flag Bad Post is marking a post if something is not in order from spam, wrong forum, request for help through email or phone, basicly anything what may be in your opinion against forum rules. Once we recieve report, we check it and make decision

oh cool ! Will do that in future.. Cheers man!

Hey, I saw this in "Flag bad post" ! :-/

Note: This is ONLY to be used to report spam, advertising messages, and problematic (harassment, fighting, or rude) posts.

hai
i am nireekshan;
i am using Mysql 5.0;
it was instaling C:\Program Files\MySQL;
i am write code Bellow see and
--save c:\ "Mysqlcon.java " in this program
run-in commend Fromt> javac Mysqlcon.java It was NOT Any Errer;
>java Mysqlcon
ERRER ACCERED.......CLASS NOT FOUND EXPATION


//I AM COPY Mysql.jar file in C:\

Try running it with java -cp .;mysql-connector-java-[ver]-bin.jar Mysqlcon . You need to have the jar file in your classpath for it to find the files.
You may want to read this documentation as well: http://dev.mysql.com/doc/refman/5.0/en/connector-j-installing-classpath.html

This article has been dead for over six months. Start a new discussion instead.