无法使用JDBC与Progress Database建立连接

时间:2016-09-29 06:51:11

标签: java jdbc openedge progress-db

我收到以下异常: -

java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Access denied(Authorisation failed)
    at com.ddtek.jdbc.openedge.client.ddd.aw(Unknown Source)
    at com.ddtek.jdbc.openedge.client.ddd.j(Unknown Source)
    at com.ddtek.jdbc.openedge.OpenEdgeImplConnection.j(Unknown Source)
    at com.ddtek.jdbc.openedgebase.BaseConnection.b(Unknown Source)
    at com.ddtek.jdbc.openedgebase.BaseConnection.k(Unknown Source)
    at com.ddtek.jdbc.openedgebase.BaseConnection.b(Unknown Source)
    at com.ddtek.jdbc.openedgebase.BaseConnection.a(Unknown Source)
    at com.ddtek.jdbc.openedgebase.BaseDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
    at com.ncr.sj250216.JdbcTest.main(JdbcTest.java:18)

我的代码中没有编译时错误,我使用正确的jar作为引用库。

      package com.ncr.sj250216;
      import java.sql.*;
      public class JdbcTest 
      {
          public static String       
 URL="jdbc:datadirect:openedge://sun3899.daytonoh.ncr.com:28409;DatabaseName=dispatch";
    public static String username="CSMSRUP";
    public static String password=null;
    public static void main(String [] args)
    {

     try
      {

       Class.forName ("com.ddtek.jdbc.openedge.OpenEdgeDriver");
       System.out.println("Driver loaded");
       Connection conn = DriverManager.getConnection(URL,username,password);
       System.out.println("Connected");
       Statement stmt = conn.createStatement();
       System.out.println("Statement created");
       ResultSet rs = stmt.executeQuery("select remark from pub.dupdate_remarks");
       System.out.println("ResultSet : \n");
       while (rs.next())
       {
        System.out.println(rs.getString(1));
        }
       System.out.println("AFTER CRUISING THROUGH THE RESULT SET");
       rs.close();
       stmt.close();
       conn.close();
      }
      catch (Exception x) 
      {
          x.printStackTrace();
      }
     }
}

1 个答案:

答案 0 :(得分:1)

Access deniedAuthorization failed表示您使用了错误的用户ID和&密码或您正在尝试连接到错误的数据库。

如果您有权访问运行数据库的服务器,则可以使用Progress'来测试您的凭据。 sqlexp命令行工具:

sqlexp -user userName -password passWord -db dnName -S servicePort

或者您可以使用任何流行的基于Windows的SQL查询工具来尝试连接......