• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
Do Re Mi Fa So La Tiny Ad
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic