蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年6月6日 10:18


[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

我安装了在W2K下安装Informix JDBC Driver 2.0不知道怎么用!!!
按以下操作好象没成功!
大家指点一下!
谢谢!

/*
环  境:Windows2000 + Java Version "1.4.1_01" + Informix JDBC Driver 2.0
数据库:Sco Unix 5.05 + Informix Dynamic Server Version 7.31.UC5
功  能:用Java实现通过JDBC访问Informix数据库,并显示表的内容
*/
import java.sql.*;
public class ifxtest
{

    public static void query() throws SQLException
    {
        String     odbcQuery;
        Connection odbcconn;
        Statement  odbcstmt;
        ResultSet  odbcrs;
        try
        {
            Class.forName("informix.jdbc.IfxDriver");
            odbcconn  = DriverManager.getConnection("jdbc:informix-sqli://192.168.1.18:8888/stores7:INFORMIXSERVER=ld18_tcp;user=informix;password=informix");
            odbcstmt  = odbcconn.createStatement();
            odbcQuery = "select * from stock";
            odbcrs    = odbcstmt.executeQuery(odbcQuery);
            while(odbcrs.next())
            {
                System.out.println("id="+odbcrs.getInt(1)+" | name="+odbcrs.getString(2));
            }
            odbcrs.close();
            odbcstmt.close();
            odbcconn.close();
        }
        catch( ClassNotFoundException e )
        {
            System.out.println("ClassNotFoundException ");
        }
        catch( SQLException e )
        {
            System.out.println("SQLException ");
        }
    }

    public static void main(String[] args) throws SQLException
    {
        query();
    }
}

[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

大家帮我!

[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

怎么没人理我!

[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

我也出的一样的问题,也是在解决中。

[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

你用的informix是中文还是英文,如果是中文,
String DBURL  = "jdbc:informix-sqli://192.168.20.140:8001/cool:informixserver=dbs;DB_LOCALE=zh_CN.57357;CLIENT_LOCALE=zh_CN.57357;user=informix;password=informix"

连接串试一下。

另外,能把错误贴出来吗?

[求助]在W2K下通过JDBC连Informix数据库怎么做呀???

classpath 指定 ifxjdbc.jar的路径

如:classpath:c:\jdk\jre\lib\ifxjdbc.jar



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com