• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

1.1 data-source security , and MySql

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all!
I am using Struts 1.1 with MySql 4.0.x.
When MySql is initially installed it has 4 users in the user table:
+-----------+---------+------------------
| Host | User | password
+-----------+---------+------------------
| localhost | root |
| % | root |
| localhost | |
| % | |
+-----------+---------+------------------
The root and the "blank" user have no passwords. The MySql book says it's a good idea to secure these users. So I did by giving them all passwords.
I then added 2 new users and gave them access to a database I will be accessing through Struts 1.1.
Here's my struts-config.xml datasource:
<data-sources>
<data-source>
<set-property property="description"
value="CD Manager sample datasource"/>
<set-property property="autoCommit"
value="false"/>
<set-property property="driverClass"
value="org.gjt.mm.mysql.Driver"/>
<set-property property="maxCount"
value="4"/>
<set-property property="url"
value="jdbc:mysql://localhost/cdsample"/>
<set-property property="user"
value="user01"/>
<set-property property="password"
value="user01pw"/>
</data-source>
</data-sources>
Here's the issue that's coming up:
When I bring up Struts, he's happy and finds no issue with the data-source. But when I issue a SQL, through an Action class on this data source, Struts complains that '@localhost' access is denied. For some reason (and maybe one of you can explain) the sql being submitted is not using the user01/user01pw access but the blank user. When I remove the password from the blank user, my SQL works.
Help!!
Thanks,
Tom Autera
reply
    Bookmark Topic Watch Topic
  • New Topic