设为首页 加入收藏

TOP

mysql的JDBC接口编程
2015-07-24 10:20:04 来源: 作者: 【 】 浏览:0
Tags:mysql JDBC 接口 编程
mysql的JDBC接口驱动包的版本和mysql的版本间的关系可以在官网上查到,具体例子见下面,里面没有和JDBC版本匹配的相关描述。
http://dev.mysql.com/doc/relnotes/connector-j/en/news-5-1-34. html
Version 5.1.34 is a maintenance release of the production 5.1 branch. It is suitable for use with MySQL server versions 5.5, and 5.6.

大概有如下的对应关系,具体版本需要具体查一下
Connector/J 5.1 支持Mysql 4.1、Mysql 5.0、Mysql 5.1、Mysql 6.0 alpha这些版本。
Connector/J 5.0 支持MySQL 4.1、MySQL 5.0 servers、distributed transaction (XA)。
Connector/J 3.1 支持MySQL 4.1、MySQL 5.0 servers、MySQL 5.0 except distributed transaction (XA) support。
Connector/J 3.0 支持MySQL 3.x or MySQL 4.1。


下面是jdbc接口连接 mysql的例子,连接串里指定了字符编码
try{
 Class.forName(com.mysql.jdbc.Driver);
 System.out.println(Success loading Mysql Driver!);
String url ="jdbc:mysql://localhost/dbName?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"
Connection conn= DriverManager.getConnection(url);
}catch(Exception e)
{
 System.out.println(Error jdbc to mysql!);
 e.printStackTrace();
}

?

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇mysql报错"ERROR 1206 (HY00.. 下一篇MySQL基本数据操作

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·C 内存管理 | 菜鸟教 (2025-12-26 20:20:37)
·如何在 C 语言函数中 (2025-12-26 20:20:34)
·国际音标 [ç] (2025-12-26 20:20:31)
·微服务 Spring Boot (2025-12-26 18:20:10)
·如何调整 Redis 内存 (2025-12-26 18:20:07)