• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem to insert data - mysql

 
mark smith
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i try to insert some value in a mysql database



i downloaded the mysql driver (jar file)

in netbeans, i added the jar into the compile, compile test and run test section for the project

when i run project, an error is catched is: import java.sql.Connection;

java.sql.SQLException: No suitable driver

any idea?
[ September 10, 2006: Message edited by: mark smith ]
 
Alice Corman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say the mySQL driver, do you mean the MySQL Connector/J jar? Did you first verify that you connect to your database (named: "test") using the mySQL client and the username/password: test/test?


Try supplying the default port number (3306) in the url:



Don't quotes around the variable names here:



Using quotes will pass in the word "url" instead of the url variable ("jdbc:mysql://localhost:3306/test"). Use:


[ September 10, 2006: Message edited by: Alice Corman ]
 
Alice Corman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correction: Default port should be 3306
[ September 10, 2006: Message edited by: Alice Corman ]
 
Rushikesh Wagh
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public String query = "insert into membre(firstname, lastname) values ("paul", "smith")";


I dont think this will worl.....
Please Try Out Single Quotes Insted Of Double Quotes .....

public String query = "insert into membre(firstname, lastname) values ('paul', 'smith')";

Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic