The method getConnection() is undefined for the type DataSource 类名 问题:导包错误 看看你的包是不是选对了,我的修改成了下面的 import javax.sql.DataSource;