| Author |
problem to insert data - mysql
|
mark smith
Ranch Hand
Joined: Apr 05, 2005
Posts: 242
|
|
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
Joined: Jun 21, 2006
Posts: 19
|
|
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
Joined: Jun 21, 2006
Posts: 19
|
|
Correction: Default port should be 3306 [ September 10, 2006: Message edited by: Alice Corman ]
|
 |
Rushikesh Wagh
Ranch Hand
Joined: Jun 18, 2005
Posts: 58
|
|
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
|
Best Regards,
Rushikesh Wagh
SCJP 1.4 (2005)
SCJP 1.6 (2010)
|
 |
 |
|
|
subject: problem to insert data - mysql
|
|
|