Type mismatch: cannot convert from ComboPooledDataSource to DataSource
来源:互联网 发布:java 压缩文件 编辑:程序博客网 时间:2024/06/15 19:57
在Eclipse 中使用c3p0数据库资源管理时:
private static DataSource dataSource = null;static{dataSource = new ComboPooledDataSource(“”);//""内的字符串为:自己在c3p0-config.xml中配置的name//这里会报错:Type mismatch: cannot convert from ComboPooledDataSource to DataSource//大致意思就是 new ComboPooledDataSource("") 的返回结果不是 DataSource 的对象//原因是上面导包出现了问题:import org.apache.tomcat.jdbc.pool.DataSource;(这个包不对)//正确的包 import javax.sql.DataSource;}/*** 返回数据源的一个Connection 对象* @return 返回一个connection* @throws SQLException */public static Connection getConnection() throws SQLException{return (Connection) dataSource.getConnection();}
阅读全文
0 0
- Type mismatch: cannot convert from ComboPooledDataSource to DataSource
- junit Type mismatch: cannot convert from Test to Annotation
- Type mismatch: cannot convert from Test to Annotation
- Id Type mismatch: cannot convert from connection to connection
- Type mismatch: cannot convert from Object to String
- Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from CharFragment to Fragment错误
- Type mismatch: cannot convert from Test to Annotation
- Type mismatch: cannot convert from Object to String
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Type mismatch: cannot convert from Test to Annotation
- Hibernate Type mismatch: cannot convert from CascadeType to CascadeType[]
- Type mismatch: cannot convert from Test to Annotation
- 解决Type mismatch: cannot convert from ByteMatrix to BitMatrix
- 关于 Type mismatch: cannot convert from Integer to int
- Type mismatch: cannot convert from Test to Annotation
- POJ-1426 Find The Multiple
- Codeforces 811A Vladik and Courtesy
- Linux离线安装SVN
- WebStrom快捷键
- ajax实战篇---城市select联动----XML交互
- Type mismatch: cannot convert from ComboPooledDataSource to DataSource
- 移植 bootm 命令启动内核
- Unity3D脚本18:可视化辅助设置类 Gizmos
- 图像傅里叶变换的幅度谱和相位谱的以及反变换
- Web基础知识
- poj3621:Sightseeing Cows(0/1分数规划、SPFA判负环)
- (转)Julia: 机器学习库和相关资料
- (牛客网)丑数
- Windows 7下用 pip 安装 markupsafe 时遇到的错误