[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: need help to use java to connect to MYSQL DB
From:       Alan Williamson
Date:       2007-11-29 11:50:00
Message-ID: 474EA778.5000905 () blog-city ! com
[Download RAW message or body]

What is the exception that is printed out?

do not stop it in the debugger; let it run and read what the exception says

Eman Hossny wrote:
> Hi all,
> i need to use Eclipse(java SDK) to connect to MYSQL DB,
> & i write the following code for connection, but when i run it no thing
> happen, no output appear, & when i debug it, i found that the debuger was
> stopped @ the line
> 
> conn=DriverManager.getConnection(connectionURL,"Eman","Eman");
> 
> ----------------------------------------my code for connection
> 
> String driver ="com.mysql.jdbc.Driver";
> String dbName="travel";
> String connectionURL = "jdbc:mysql://localhost/" + dbName;
> try{
>      //load the driver
>       Class.forName(driver).newInstance();
>       conn=DriverManager.getConnection(connectionURL,"Eman","Eman");
>        System.out.println("Successfully connected to " +
> 	               "MySQL server using TCP/IP...");
>        }
>        catch(Exception e)
>        {
>     	   e.printStackTrace();
>          System.out.println("Error "+e.getMessage());
>        }
> -----------------------------------------
> 
> -note: i added the connector/j.jar to the classpath environment variable
> -Is the connector/J version must be consistent with the jdk version?
> -i consume more time to solve this problem but till now didn't reach to any
> thing.any help please,
> waitting for reply
> 
> 
> 

-- 
Alan Williamson
  "a wiki -and- a blog" @ http://www.Blog-City.com/

  b: http://alan.blog-city.com/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic