This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Connecting to MySQL from eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Connecting to MySQL from eclipse" Watch "Connecting to MySQL from eclipse" New topic
Author

Connecting to MySQL from eclipse

Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
Hi, I have mySql downloaded and the workbench, how do I go about connecting it to Eclipse? First I need to create a server right? weeks ago when I first downloaded mySql I spend a while but was able to do it, since then I am not able to. Maybe that first time I could not either and mistook it as success. Anyway, I have the latest version of MySQL, how do I start a server then connect it to Eclipse?

And if I use GIT or SVN, how do I share the DB data with people I work with, because that is stored "locally," so how do we both have the same data then?

thanks
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
Oh, and would someone be able to help me set this up by weekend? I spent hours and hours and hours on it, and I tried the net for help as well, to no avail.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

Could you go back a few steps and explain what you're trying to do? I think you may be working against some misconceptions, but it's hard to tell for sure. For example it appears you want to share the data with other people -- naturally, databases are meant to be shared -- but then you ask about that in the context of git and SVN, which have nothing at all to do with setting up a database. Normally you would just run a database server and allow people to connect to it.

And then you mentioned connecting MySQL to Eclipse -- again, I don't know why you would want to do that, so an explanation of your ultimate goals would help.
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
f
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Bob Goodman wrote:And if I use GIT or SVN, how do I share the DB data with people I work with, because that is stored "locally," so how do we both have the same data then?

As already mentioned, Git and Subversion are source control tools and have nothing at all to do with the database. They're how you would share code, not data. Also, whether you write the code in eclipse or not is also pretty much irrelevant.

The data in the DB is shared when the DB is available on a server, and programs use Hibernate (or JDBC, or whatever) to connect to the database.

To use Hibernate, I'd start with the Hibernate tutorial.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
Bear, that does not help. My MAIN question is how do I connect to the server with mySql? thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

Bob Goodman wrote:My MAIN question is how do I connect to the server with mySql? thanks


But that doesn't really make sense. MySQL is the server. If you're asking how to run MySQL, then there are instructions on the MySQL site about how to run the server on whatever operating system you are targeting.

And likewise you don't use Hibernate to store data on the server. At least, not really. Hibernate is a tool which allows you to access the data from Java code without having to write pages and pages of JDBC code.
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
Hi,

I need to get a server started on mySQl, then connect that with Eclipse right? This is what I want to do.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

Well, okay then. Have you installed the server yet? Started it? So far we don't know what you have done, or what you are having a problem with.
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
I cant install the server, and when I get a server going, it wont start. I havent seen it in weeks, but weeks ago I spend hours on it and could not fix it, I have not been able to get to it til now.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

When you say "server", what exactly do you mean? Do you mean the MySQL DB? If so, I'd advise wiping out what you have now, and start fresh using instruction from the MySQL site. Also, bear in mind that mySQL is only one choice of DB. Maybe you'd find it easier to set up an instance of PostgreSQL? MariaDB?

How are you determining whether the DB is successfully running? There are likely tools that come with MySQL that could help. (I'm most familiar with PostgreSQL, so I can't say for sure.)

There are also separate tools, such as Squirrel SQL that you can use to connect to and view the DB.

In any case, until the DB is running correctly, everything else is moot.
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
BEar, I dont need another DB, Iw ant to use MySql, if you dont know abnout it, please dont answer. Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

Bob, if you want help you're going to have to start participating in this thread. Just saying "I wanna" isn't helpful.

Here are the steps you have to follow:

1. Download the MySQL server from the MySQL site. Make sure you download the right version of the server, and make sure it's the download which matches the operating system.

2. Install the download. There should be instructions on how to do that available from the same place you found the download.

If you have any problems with any of that, ask a question about those problems. So far you haven't done that, all you have done is to say that you had a problem. That isn't enough information for anybody to give you meaningful help, that's why you haven't been getting meaningful help. Have a look at our FAQ page TellTheDetails (<== click on that link) which should help you to ask better questions.
Bob Goodman
Ranch Hand

Joined: Jul 18, 2013
Posts: 31
Are you guys trolling me? I SAID I DID DOWNLOAD mysql and the work bench already, cmon guys read the whole thing please
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18115
    
    8

Paul Clapham wrote:If you have any problems with any of that, ask a question about those problems. So far you haven't done that, all you have done is to say that you had a problem. That isn't enough information for anybody to give you meaningful help, that's why you haven't been getting meaningful help. Have a look at our FAQ page TellTheDetails (<== click on that link) which should help you to ask better questions.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

Bob Goodman wrote:please dont answer.

Wish granted.
 
 
subject: Connecting to MySQL from eclipse
 
Similar Threads
JDBC and MySQL
which DBMS to learn ??
Unable to connect to mysql through ecllipse
MySQL GUI Client on Linux
Download image/video in JavaScripting