This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The type Connection is ambiguous - error message  RSS feed

 
Bob Matthews
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a java program which references a derby database and as such I have the following line of code........


Now, I have added this import, as I wish to utilize activeMQ


Where is the ambiguity occurring and how do I fix the problem?

BobM


 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In one of your other imports you have a Connection class, so you can always reference the class by its full package name and eliminate any confusion that might exist:
 
Bob Matthews
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes - I had gathered that

but I don't know how to identify which import ?
 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't really matter if the connection object is the only thing giving you problems, once you qualify it with the package name, your error will go away.

Bob Matthews wrote:yes - I had gathered that

but I don't know how to identify which import ?
 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to actually find the packages causing the error, the look at your imports and start a new project with the same imports, remove them from the project 1 by 1 until you find the package causing the problem, or turn on the context sensitive auto complete in your IDE and start typing in package names and after the last dot, hit a C and see if there is a connection class listed, if not, move on to the next.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!