wood burning stoves 2.0*
The moose likes JDBC and the fly likes problem in type 4 driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem in type 4 driver" Watch "problem in type 4 driver" New topic
Author

problem in type 4 driver

Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 937
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

Joined: Oct 27, 2005
Posts: 19552
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Punit Jain
Ranch Hand

Joined: Aug 20, 2011
Posts: 937
yeah , i m using IDE..
thanks...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: problem in type 4 driver
 
Similar Threads
problem to insert data - mysql
First Bean with Database
Displaying a ResultSet Problem
Help with this code!
user authentication servlet problem