LINUX +的Java + ODBC +进步党

时间:2014-05-06 17:25:39

标签: java linux odbc openedge progress-db

您好我需要将Linux服务器上的Java应用程序连接到Progress数据库。我用来连接在Linux服务器上配置的odbc,它可以正常工作,从命令行我可以查询。问题是当我尝试从Java应用程序获取连接时,我得到一个空指针。

Java版本1.6.0_45 操作系统:CentOS 6.5版 ODBC进展:工作正常

这是测试de Insert into Progress

的方法体
try {
        String bd = "dbToWrite";
        String url = "jdbc:odbc:" + bd;
        String user = "root";
        String psw = "root";
        Connection con;
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        con = DriverManager.getConnection(url, user, psw);
        PreparedStatement ps1 = con.prepareStatement("INSERT INTO PUB.\"mo-chsu\" "
                + "(\"c-expt\", \"c-tisu\", \"i-cheq\","
                + " \"c-a#o\", nombre, apellido, "
                + "\"n-tarj\", \"c-cat\", varios, "
                + "\"s-sac\", embar, otros, "
                + "jubi, \"ti-doc\", \"num-doc\", "
                + "\"co-min\", \"n-liq\", fonavi,"
                + " club,\"n-mes\", anioe)"
                + "VALUES (9999,999,9999.99,"
                + "2014,'XXXX','XXXX',"
                + "999,5,888.88,"
                + "1.0,2.0,3.0,"
                + "4.44,9,99999999,"
                + "1,9,3000,"
                + "30.0,9,2014)");
        ps1.execute();

        con.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

例外是,并没有说太多:

java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at Main.conexionProgress(Main.java:23)
at Main.main(Main.java:10)

我认为这个问题是关于Java的库...但我可以找到一个女巫。

请帮我一把!谢谢 对不起我的英文:)

0 个答案:

没有答案