• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Eclipse + MySQL = cannot connect

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot connect mySQL to eclipse :-( why?

1) mysql-connector-java-5.0.8-bin---> C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext

2) MySQL Server 5.0

3) Windows XP

4) Username: root?

5) Data Source Explorer, Database Connection, new MySQL ....

6) TestConnection: Ping failed.
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database 'database'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:206)
at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:104)
at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53)
at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:72)
at org.eclipse.datatools.enablement.internal.mysql.connection.JDBCMySQLConnectionFactory.createConnection(JDBCMySQLConnectionFactory.java:28)
at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:355)
at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)



Thanks ;-)
 
Marshal
Posts: 27371
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any code, but guessing from that stack trace, your JDBC URL string said you wanted to connect to a database named "database". The MySQL server responds that there isn't any such database. Given that response, you might want to change your URL string to reference a database which does exist.
 
Lenny Peter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have not a database ;-)..I thought that I could connect eclipse to mySql without to have a database..just import DB driver..

I have tried to make connection to DB i NetBeans - Oracle, but not in Eclipse (+MySQL)
Where can I find a "connect Eclipse to mySql tutorial" or a just a example what I can do? Step by step...
I have searched in google, but I have not found some good example...

 
Ranch Hand
Posts: 1871
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I tried the same thing in my eclipse.

The driver is different in my case mysql-connector-java-5.0.4-bin.jar, but that should not be the problem

Try accessing the mysql server via the command prompt. and then execute the command

show databases;

This should help you understand the databases that exist in your system.

In eclipse on the page

Select a driver from the drop-down and provide login details for the connection.
database : use one from the command result 'show databases;'
URL : jdbc:mysql://localhost:3306/

rest should workfine.

I had a problem that after i put in the database the URL also had database specified. Needed to remove that.

BR
Rahul P.Mahindrakar



remove.JPG
[Thumbnail for remove.JPG]
file shows the options
 
Lenny Peter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have removed (database)
from URL : jdbc:mysql://localhost:3306/database
to URL : jdbc:mysql://localhost:3306/ and it works well

Thanks Rahul
 
Lenny Peter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

One more question ;-)

I have logedd into MySQLAdministrator as root + my password. After that I create a new user...exit...login to MySQLQueryBrowser as new user + password
and I try to create a new schema = Error while executing query + MySql Error NUmber 1044

??

Thanks
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a pretty good MySQL Tutorial on the MySQL web site. They also have a list of the Errors you will get and what they mean. Perhaps using those resources properly will help you through this.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
work like charm
 
I need a new interior decorator. This tiny ad just painted every room in my house purple.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic