How to connect to MySQL 5.0 using Database Explorer [message #161810] |
Thu, 20 July 2006 01:02  |
Eclipse User |
|
|
|
Originally posted by: surya_is_the_man.yahoo.com
Hey all you pro Eclipse users,
I am a recent user of Eclipse starting with release 3.2 and so far I must
say I am enjoying it. Coming from a Netbeans, and a JDeveloper background,
there were some things missing like EJB creation wizards that do most of
the legwork for you but other than that it is a joy to use.
I had a question as posted in the title...I wanted to connect to my mysql
5.0 database through the database explorer and though I tried I could not
get it to work. I would like some pointers if you guys have any. I am
suprised that with such a recent release of Eclipse the Mysql 5.0 version
connection is not included by default in the already quite impressive list
of databases in the database explorer!
Thanks a lot for all your help.
Cheers!
Surya
|
|
|
|
|
Re: How to connect to MySQL 5.0 using Database Explorer [message #162282 is a reply to message #161810] |
Tue, 25 July 2006 00:01  |
Eclipse User |
|
|
|
You might be in luck...I just managed to make it work tonight. I'm not
sure if Eclipse has installed a MySQL JDBC driver (I see one there), but I
would prefer to grab the latest/greatest from MySQL to use for other
programs.
Steps to follow...
1) Visit http://dev.mysql.com/downloads/ and download the MySQL
Connector/J driver. (you're choice of 5.0 or 3.1)
2) Un-zip the archive to a directory.
3) In the director is both the binary and source. For quick install, lets
grab the *.jar file (mysql-connector-java-xx.yy.0-bin.jar -> xx and yy
depend on what you grabed in step 1 above) and copy it to the
$JAVA_HOME/jre/lib/ext folder.
4) Open your Eclipse and start the Database perspective. Select
File->New->Other... and select "Connection Profile"
5)Select "SQL Model-JDBC Connection"
6)Give your "Connection Profile" a short name and maybe a brief
description. Click "Next" when done.
7) The next window is where all the complicated stuff happens...
-a- select the elipse box ("...") to select the JDBC driver
-b- scroll down the list until you get to MySQL
-c- you'll see two versions 4.1 and 4.2. Select 4.2
(I'd recommend 4.2 as that was a major change to MySQL and 5.0 works with
this - as far as I can see)
-d- click the "Edit" Button (brings up yet another dialog)
--i--> we're adding the jar file we installed earlier
--ii--> select "Add jar/zip"
--iii--> navigate to $JAVA_HOME/jre/lib/ext and select the MySQL Connector/J
jar file we copie here earlier
--iv--> remove the default file placed by Eclipse
--v--> click "OK" button
-d- click "OK" button
8) We're back at the "New JDBC Connection Profile" Dialog. It should be
populated with values based on our jar file selected above (i.e. "MySQL
JDBC Driver", URL "jdbc:mysql://localhost:3306/database", etc).
9) Remeber that anything after "...:3306/..." is the actual database in
MySQL you want to connect to. Feel free to erase this. Also, change the
"Database" entry to the name of a schema in your MySQL database (or just
put in "mysql" to get the main schema).
10) Fill in user name (if not using root) and password
11) Click the "Test Connection" button. If the "Ping Fails" click details
to see why. (Java can be helpful and very verbose when it comes to JDBC
errors :-> )
12) And you now have access to your MySQL database of choice :->
Note:
computer location - if you have a database on another computer, change
localhost in the url to the network name of the computer
Port - if you changed the port during the MySQL install from the default
3306, change 3306 to the port number you used in the URL string
Good Luck
SWLF
|
|
|
Powered by
FUDForum. Page generated in 0.31949 seconds