Solved

java.sql.SQLException:General error

Posted on 2003-11-16
17
724 Views
Last Modified: 2008-03-06
good days!

i faced this problem
java.sql.SQLException: General error,  message from server: "Access denied for user: '@%' to database 'cproduction'"       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)       at com.mysql.jdbc.Connection.createNewIO(Connection.java:1566)       at com.mysql.jdbc.Connection.<init>(Connection.java:491)       at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)       at java.sql.DriverManager.getConnection(DriverManager.java:512)       at java.sql.DriverManager.getConnection(DriverManager.java:193)       at PickDraw.paint(PickDraw.java:210)       at sun.awt.RepaintArea.paint(RepaintArea.java:180)       at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)       at java.awt.Component.dispatchEventImpl(Component.java:3586)       at java.awt.Container.dispatchEventImpl(Container.java:1582)       at java.awt.Component.dispatchEvent(Component.java:3367)       at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:191)       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)       at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

when i run an applet that need to query some data from database named mydb.

if i create a new account and use the new account id to acess the applet, then very things will run probably.
but if i logout from the system, and use the account id that created just now to acess the applet, this error will occur.

can somebody pls tell me what cause this error to occur and how to solve this problems...

thanks in advance.

rgds;
sw
0
Comment
Question by:sweewan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 2
17 Comments
 
LVL 17

Expert Comment

by:Squeebee
ID: 9763557
"Access denied for user: '@%' to database 'cproduction'"

Your applet passed '@%' as a username. This would not be a valid username and is not likely to be the username you wanted to pass in the first place. Your applet will need to pass a valid MySQL username and password for database access.
0
 

Author Comment

by:sweewan
ID: 9768157
Good Days!

Squeebee;

but i didn't set any password and username in order to acess MYSQL.

and if i created a new username for the system, every things run properly.
but if i logout from the system, and login again the username just created, this error will occur.

pls give some hints and guide.

thanks in advance.

rgds;
sw
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9768401
Well, something is being sent to the user, perhaps the '@%' string is being appended by your application. As for users not working after logging out, this could have to do with how the MySQL user is created. What is the code to create a new user?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:sweewan
ID: 9768750
Squeebee;
0
 

Author Comment

by:sweewan
ID: 9768757
Squeebee;

the system will generate a username and password for user after a user finish all the pre-registration process.

i insert the username and password create by the system into db.

i use JSP and applet.

everythings run properly.. just the applet.

Thanks for ur suggestion and idea.

rgds;
sw
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9768779
Could it be that you are adding the user in a transaction that is never committed?
0
 

Author Comment

by:sweewan
ID: 9769176
Squeebee;

i try my system in my pc oredi.. every things oso run properly.

but when i deploy my system in other pc. this problems come out!

i oso dunno why this error occur.

Thanks.

rgds;
sw
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9770831
Hmm, did you install the JDBC driver properly on the second machine?
0
 

Author Comment

by:sweewan
ID: 9775439
good DAys!

squeebee;

yupe..

for the system, have few jsp file and 1 applet file.

for the jsp file, it run properly.. i mean insert record in db, no error occur.
but for the applet, when i  use applet to access db, that error occur oredi...

i check the table db in mysql, the column for host is % and the column for Db is test%, do i need to add another column in that table (host = % and Db = cprodcution)?
i check the db in mysql in the pc that run sucessfully, data inside the table db is same with the pc that can't  run properly...

Thanks for ur idea and Suggestion..

rgds;
sw
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9776361
Well, unfortunatly my Java knowledge is NULL, have you tried posting a request in the Java area of EE?
0
 

Author Comment

by:sweewan
ID: 9776456
Squeebee;

so.. u think should the java problems, and not the MYSQL's problems... right..?

 thanks for u suggestion..

rgds;
sw
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9780211
I would say yes based on the error message you recieved. Since it said the username passed was '@%', this would indicate to me that the Java app is passing an invalid username. This is of course based on my lack of knowledge of Java, so I am just going by the error message MySQL produced.
0
 

Accepted Solution

by:
sobhunv earned 100 total points
ID: 9887429
Hi guys..
In fact I had that Access denied problem in JSP pages...

Here r some ways I solved them:

1: install MYSQL ODBC 3.5 or more
2: Or find the jar file for java-mysql connector
     It is usually a jar file
     Unjar it and then place it in the JDK/lib directory..

It can work friends..
Cheers
sobhunv
0
 

Expert Comment

by:sobhunv
ID: 9887432
Remember this should be done on the SERVER..
0
 
LVL 17

Expert Comment

by:Squeebee
ID: 9888943
Well good to know you found a solution.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question