设为首页 加入收藏

TOP

一个JDBC-ODBC桥的字符集参数的例子。
2011-06-09 12:52:19 来源: 作者: 【 】 浏览:596次 评论:0
//这个例子,是从SUN的站点上找来的。当时也找了好久啊。呵呵!
// accepts sql statments thru command line
import java.sql.*;
import java.util.*;
public class test {
public static void main(String args[]){
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Properties prop = new Properties();
prop.put("user", "");
prop.put("password","");
prop.put("charSet","gb2312");
Connection conn=DriverManager.getConnection("jdbc:odbc:chinese",prop);
Statement stmt=conn.createStatement();
stmt.execute(args[0]);
}
catch(ClassNotFoundException e)
{
// JOptionPane.showMessageDialog(null,"Unable To Load The Driver Class","Login Message", JOptionPane.ERROR_MESSAGE);
}
catch(SQLException e)
{
e.printStackTrace();
System.out.println(e.getErrorCode());
}
}

您看到此篇文章时的感受是:
Tags: 责任编辑:administrator
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇Java学习路径(三)过程篇 下一篇设计迷踪:给JAVA设计开发新手的一..

评论

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

相关栏目

最新文章

图片主题

热门文章

推荐文章

相关文章

广告位