This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Access denied for user 'jboss'@'localhost' to database 'titan'

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
, Could you please help with this?

Thanks,

Giuseppa

I created a user name
mysql> GRANT ALL PRIVILEGES ON jboss.* TO jboss@localhost IDENTIFIED BY 'password'
I checked that everyting was going smoothly:
mysql> select User,Host,Password from mysql.User;
+-------+-----------+-------------------------------------------+
| User | Host | Password |
+-------+-----------+-------------------------------------------+
| root | localhost | *7B9CB6FF820F8EB2569BBC05BF1F871CE258444F |
| jboss | localhost | *7B9CB6FF820F8EB2569BBC05BF1F871CE258444F |
| root | % | *7B9CB6FF820F8EB2569BBC05BF1F871CE258444F |
+-------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)

This is my mysql-ds.xml file, which is in C:\jboss-6.1.0.Final\server\default\deploy
<?xml version="1.0" encoding="UTF-8"?>
<datasources><local-tx-datasource><jndi-name>MySqlTitanDS</jndi-name><connection-url>jdbc:mysql://localhost:3306/Titan</connection-url><driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 1.Comment out user-name/password if you are using anonymous account 2. Adjust user-name/password if you are using different values -->
<user-name>jboss</user-name><password>giuseppa</password><min-pool-size>5</min-pool-size><max-pool-size>30</max-pool-size><exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter </exception-sorter-class-name><metadata><type-mapping>mySQL</type-mapping></metadata></local-tx-datasource><local-tx-datasource><jndi-name>MySqlSamplesDS</jndi-name><connection-url>jdbc:mysql://localhost:3306/Samples</connection-url><driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 1.Comment out user-name/password if you are using anonymous account 2. Adjust user-name/password if you are using different values -->
<!-- <user-name>jboss</user-name> <password>giuseppa</password> -->
<min-pool-size>5</min-pool-size><max-pool-size>30</max-pool-size><exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter </exception-sorter-class-name><metadata><type-mapping>mySQL</type-mapping></metadata></local-tx-datasource></datasources>

Mysql-connector-java-5.1.36.jar is in C:\jboss-6.1.0.Final\server\default\lib

FirstBeansTitan.jar is in
C:\jboss-6.1.0.Final\server\default\deploy\applications



I follow these steps to run my application:
Turn off jboss
In the home directory of the application, run the following commands:
Ant clean
Ant ejbjar

C:\FirstBeans>ant clean
Buildfile: C:\FirstBeans\build.xml

clean:
[delete] Deleting directory C:\FirstBeans\build

BUILD SUCCESSFUL
Total time: 0 seconds

C:\FirstBeans>ant ejbjar
Buildfile: C:\FirstBeans\build.xml

prepare:
[mkdir] Created dir: C:\FirstBeans\build
[mkdir] Created dir: C:\FirstBeans\build\classrues

compile:
[javac] Compiling 4 source files to C:\FirstBeans\build\classrues

ejbjar:
[jar] Building jar: C:\FirstBeans\build\FirstBeansTitan.jar
[copy] Copying 1 file to C:\jboss-6.1.0.Final\server\default\deploy\applica
tions

BUILD SUCCESSFUL
Total time: 2 seconds

Start Jboss server again

C:\FirstBeans> ant run.client

I get the following:
[java] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
: Access denied for user 'jboss'@'localhost' to database 'titan'

This is he error from the log file


C:\FirstBeans>

 
Pepa Cefalu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved.
mysql> GRANT ALL PRIVILEGES ON databasename.* TO databasename@localhost IDENTIFIED BY 'password'

Use databasename as user name and database password as password in MySQL-ds.xml file.

Thanks
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!