Solved

java.sql.SQLException:General error

Posted on 2003-11-16
17
720 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Suggested Solutions

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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