aspose file tools*
The moose likes Cattle Drive and the fly likes JDBC-2a - Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "JDBC-2a - "ant db" now works" Watch "JDBC-2a - "ant db" now works" New topic
Author

JDBC-2a - "ant db" now works

Mark Beattie
Greenhorn

Joined: Mar 30, 2006
Posts: 26
I finally got ant to drop and create new tables using 'ant db' on the command line.

The main problem I had was that MySQL keeps older files hanging around, making it difficult to get new configurations to work. Solution - remove MySQL then reinstall.

The build.xml problem: The first time I got MySQL to work I did not set up a user with a password. I was able to start MySQL from the command line using 'mysql -u root'. This did not work with the 'ant db' because the response I kept getting said something about using a password.

After a lot of experimenting and online research I came across a useful command: mysql -u root -p
-p means login with a password.
So, I configured MySql with a security password. Tested mysql -u root -p on the command line. Success! Then set the property files for the ant with the security password. Ran ant with the command 'ant db' Success! phew
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
I wonder if this is something new. Which version of mySQL are you using?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Mark Beattie
Greenhorn

Joined: Mar 30, 2006
Posts: 26
The MySQL version, I think, is: 5.0.24a-community-nt

Regarding the build properties files. I am not sure that I tried out all the possible passwords properties in my userName.properties file:

...
db.userid=root
db.password=password

The above properties work for my current setup.

In the previous set up I tried 'null' but can't recall what else I tried.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
...
db.userid=root
db.password=

??
Mark Beattie
Greenhorn

Joined: Mar 30, 2006
Posts: 26
Hi Marilyn,

I cannot recall if I used:

db.password=

I probably left off the '=' sign and used:

db.password

I do recall removing db.password from the properties file and the the db.password codes from the build.xml file. That did not work.

I tried again just now with 'db.password='. I reconfigured the MySQL instance - this did not work. Then I removed and created a new MySQL instance - still did not work. For some reason the security password is still needed to access MySQL. I don't know why the application is so stubborn with me now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC-2a - "ant db" now works