Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Unbelievable problem with MySql connection(Problem depends of Eclipse version (!!!))
Unbelievable problem with MySql connection [message #754093] Mon, 31 October 2011 17:56 Go to next message
elGringo  is currently offline elGringo Friend
Messages: 3
Registered: October 2011
Junior Member
Hi there!

I just got a problem, and i can't undetstand, how can it be. Sad

My code:
	try {
            DriverManager.registerDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
            Connection c = DriverManager.getConnection("jdbc:mysql://localhost/village", "root", "psw");
    	} catch (Exception e) {
    		e.printStackTrace();
    	}

Simplest code ever Smile And it works great, when i run it in Eclipse 3.3.2, also it works great when I run it in command line "java.exe .....".
But it causes an exception in Eclipse 3.4.*, 3.5.*, and Indigo.

The exception is:
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943)
	at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1308)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at main.main.main(main.java:22)


As you can see in source code upper, I use constant database URL, username and password, and it works in Eclipse 3.3.2 without any exception. I use the same database driver mysql-connector-java-5.1.18-bin.jar (I've try some other versions without any results)

All versions of eclipse I used "just out of box" - without any settings and customizing.

I just can't imagine where may be a problem. All i can say - something depends of Eclipse version.

I can't use new Eclipses because of it Sad
Can somebody help me?

[Updated on: Tue, 01 November 2011 07:07]

Report message to a moderator

Re: Problem with connection with database [message #754141 is a reply to message #754093] Tue, 01 November 2011 03:20 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
Please ask this question in Newcomer or Datatools forum.
Previous Topic:Problems to install Draw2
Next Topic:Unable to see JSP variable contents in Eclipse Helios
Goto Forum:
  


Current Time: Thu Apr 25 00:32:26 GMT 2024

Powered by FUDForum. Page generated in 0.02326 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top