Solved

java.sql.SQLException:General error

Posted on 2003-11-16
17
718 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
  • 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
 

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now