salamu alikom all,
actually i'm new in Eclipse & i need to use it 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 with stop in the line
conn=DriverManager.getConnection(connectionURL,"root","");
----------------------------------------my code for connection
String driver ="com.mysql.jdbc.Driver"; //"org.apache.derby.jdbc.EmbeddedDriver";
String dbName="travel";
String connectionURL = "jdbc:mysql://localhost/" + dbName;
//String createString="CREATE TABLE Users(Id INT PRIMARY KEY,"+
//"Username VARCHAR(30),Password VARCHAR(30));";
try{
//load the driver
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(connectionURL,"root","");
if(!conn.isClosed())
System.out.println("Successfully connected to " +
"MySQL server using TCP/IP...");
//stmt=conn.createStatement();
//System.out.println (" . . . . creating table WISH_LIST");
//stmt.execute(createString);
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Error "+e.getMessage());
}






if this code works outside
if this code works outside eclispe ?
if you connect to a DB before copy and paste the code to make sure that the driver name and connection string are valid.
try to print the error message if any.
***************** لا اله إلا الله *************************
You should add the port to
You should add the port to the connection URL
"jdbc:mysql:localhost:3306/"+dbName
Ahmed Hashim hashimblog/