Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in type 4 driver  RSS feed

 
Punit Jain
Ranch Hand
Posts: 1030
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m getting an error in this code..



error is in these two line:



and error is:


Type mismatch: cannot convert from java.sql.Statement to com.mysql.jdbc.Statement


although i have added mysqlConnector to my jar files, but still i m getting the same error..???
 
Rob Spoor
Sheriff
Posts: 20937
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should never import any driver specific classes, but instead program against the JSE interfaces. You've probably used an IDE to resolve the import and chose the wrong one. So instead of importing com.mysql.jdbc.Statement, import java.sql.Statement.
 
Punit Jain
Ranch Hand
Posts: 1030
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah , i m using IDE..
thanks...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!