Skip to main content
Jump to: navigation, search

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

(MySQL 4.x and 5.x)
(MySQL 4.x and 5.x)
Line 3: Line 3:
 
==MySQL 4.x and 5.x==
 
==MySQL 4.x and 5.x==
  
* Define a driver template for MySQL 4.1 (use this for 5.x too).
 
[Where?]
 
 
* Let un == user name (for example, "root")
 
* Let un == user name (for example, "root")
 
* Let pw == password
 
* 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
  
Then
+
Next, create the connection profile (Window, Show View, Data Source Explorer, right-click Databases, New)
[Where?]
+
* Jar: mysql-connector-java-5.0.0-beta-bin.jar
+
* Database: mysql
+
* Driver: com.mysql.jdbc.Driver
+
* URL: jdbc:mysql://localhost/?user=un&password=pw
+
 
+
Next, create the connection profile:
+
[Where?]
+
 
* Choose "SQL Model-JDBC Connection"
 
* Choose "SQL Model-JDBC Connection"
* Give the profile an appropriate name, such as "MySQL"
+
* Give the profile an appropriate name, such as "MySQL - yourDatabaseName"
* Choose the driver template you just created from the combo box
+
* 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
 
* "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.
 
'''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.
 
Driver Definitions?
 
How to add a Driver Definition for MySQL?
 
Why can't I edit an existing Driver Definition?
 

Revision as of 06:10, 20 July 2007

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 "SQL Model-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