View Single Post

   
  #7 (permalink)  
Old 02-28-2008, 10:27 AM
Peter H. Coffin
 
Posts: n/a
Default Re: Connecting to mySQL database over the LAN

On 21 Mar 2007 06:16:05 -0700, Mithil wrote:
> I am sorry for all the trouble of not putting up my Question properly
> the error i get is :
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver


Perhaps I do not know Java very well. This sounds like an error
indicating that

>
> when I run the code:
>
> import java.sql.*;
> import java.lang.*;
>
> public class testingJDBC {
>
> /** Creates a new instance of testingJDBC */
> public testingJDBC() {
> }
>
>
>
> public static void main(String argsp[]){
> try{
> Statement stmt;
> Class.forName("com.mysql.jdbc.Driver").newInstance ();


this line above is the one causing the problem, because it is not where
the interpreter/compiler/runtime enviornment is expecting it to be.

> String url ="jdbc:mysql://147.25.238.215:3306/test";
> Connection con =DriverManager.getConnection(url,"root",
> "000000");
> stmt = con.createStatement();
> stmt.executeUpdate("CREATE DATABASE JunkDB");
> }
> catch(Exception e){
> System.err.println("connection cann't be established
> \n"+e);
> }
> }
> }
>
>
> Please help me out I am stuck at this point.
>
> Thanking you in advance,
> Mithil
>



--
100. Finally, to keep my subjects permanently locked in a mindless trance, I
will provide each of them with free unlimited Internet access.
--Peter Anspach's list of things to do as an Evil Overlord
Reply With Quote