Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Connecting to MySQL 4.x and 5.x"

 
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
==MySQL 4.x and 5.x==
 
==MySQL 4.x and 5.x==
 +
 +
* Let un == user name (for example, "root")
 +
* Let pw == password
 +
 +
* Define a driver template for MySQL 4.1 (use this for 5.x too). (Window, Preferences, Connectivity, Driver Definitions; select Database, MySQL, 4.1, click Add)
 +
* Then in "Available driver templates", select Database, MySQL, 4.1, MySQL JDBC Driver, and give driver a name like "My MySQL". Check "Edit New Driver Definition Immediately". Click "OK".
 +
* Remove faulty jar files, and add the right one (like mysql-connector-java-5.0.4-bin.jar) from known location (if you don't have one, download it from MySQL site)
 +
* Database name: yourDatabaseName
 +
* Driver class: com.mysql.jdbc.Driver
 +
* Connection URL: jdbc:mysql://localhost/yourDatabaseName
 +
* User ID: un
 +
* Password: leave blank, will be added later
 +
 +
Next, create the connection profile (Window, Show View, Data Source Explorer, right-click Databases, New)
 +
* Choose "Generic JDBC Connection"
 +
* Give the profile an appropriate name, such as "MySQL - yourDatabaseName"
 +
* Choose the driver template you just created from the combo box (e.g. "My MySQL")
 +
* Add password
 +
* Test connection with "Test connection" button
 +
* "Finish" to save the connection profile
 +
 +
'''Note''' that you might have to tweak these values for your case. Results in a partial tree in Data Source Explorer, and can be used with the SQL Editor.

Latest revision as of 17:04, 14 April 2008

Back to How Do I Connect to...

MySQL 4.x and 5.x

  • Let un == user name (for example, "root")
  • Let pw == password
  • Define a driver template for MySQL 4.1 (use this for 5.x too). (Window, Preferences, Connectivity, Driver Definitions; select Database, MySQL, 4.1, click Add)
  • Then in "Available driver templates", select Database, MySQL, 4.1, MySQL JDBC Driver, and give driver a name like "My MySQL". Check "Edit New Driver Definition Immediately". Click "OK".
  • Remove faulty jar files, and add the right one (like mysql-connector-java-5.0.4-bin.jar) from known location (if you don't have one, download it from MySQL site)
  • Database name: yourDatabaseName
  • Driver class: com.mysql.jdbc.Driver
  • Connection URL: jdbc:mysql://localhost/yourDatabaseName
  • User ID: un
  • Password: leave blank, will be added later

Next, create the connection profile (Window, Show View, Data Source Explorer, right-click Databases, New)

  • Choose "Generic JDBC Connection"
  • Give the profile an appropriate name, such as "MySQL - yourDatabaseName"
  • Choose the driver template you just created from the combo box (e.g. "My MySQL")
  • Add password
  • Test connection with "Test connection" button
  • "Finish" to save the connection profile

Note that you might have to tweak these values for your case. Results in a partial tree in Data Source Explorer, and can be used with the SQL Editor.

Back to the top