On 29/12/2011 05:45, Lau Eng Huat wrote:
Hi tomcat experts,
I'm having this problem with the mysql connection in tomcat using netbeans.
I'm always having a exclamation mark on the Blue World Globe in netbeans
project tabs.
I don't know what that means.
Everytime I try to resolve the data source problem using New
Connection Wizard in netbeans, the database textfield is always mysql.
No idea about this either.
I
change it to abc_admin and press test connection button , it managed to
connect. When I press the finished button I always get Unable to add
connection. Connection already exist
Are you having an issue with Netbeans rather than with Tomcat? If so,
you may find more help with that community.
p
Web.xml :
resource-ref
descriptionGRANT SELECT, INSERT, DELETE, UPDATE ON abc_admin.*
TO 'all_100'@'localhost' IDENTIFIED BY 'gpwd_admin'/description
res-ref-namejdbc/my_admin/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
Context.xml
==
Resource name=jdbc/my_admin auth=Container
type=javax.sql.DataSource
maxActive=20
maxIdle=30
maxWait=1
username=all_100
password=gpwd_abc_admin
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/abc_admin?autoReconnect=true
/
MYSQL Create Users
=
CREATE USER 'all_100'@'localhost' IDENTIFIED BY 'pwd_abc_admin',
FLUSH PRIVILEGES,
GRANT SELECT, INSERT, DELETE, UPDATE ON abc_admin.*TO
'all_100'@'localhost' IDENTIFIED BY 'gpwd_abc_admin',
FLUSH PRIVILEGES,
Java Code to get the connection
===
protected Connection getCardDatabaseConnection(String ConnectionType)
throws NamingException, SQLException {
Connection connection = null;
DataSource dataSource;
InitialContext initialContext;
initialContext = new InitialContext();
dataSource = (DataSource) initialContext.lookup(java:comp/env/ +
jdbc/my_admin);
connection = dataSource.getConnection();
return connection;
}
--
[key:62590808]
signature.asc
Description: OpenPGP digital signature