[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

java.sql.SQLException:General error

Posted on 2003-11-16
17
Medium Priority
?
726 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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 400 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

656 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