简体   繁体   中英

Not able to establish connection with Progress Database using JDBC

I am getting the following exception :-

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)

There is no compile time error in my code, i am using the right jars as referenced libraries.

      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();
      }
     }
}

Access denied and Authorization failed mean that you either have the wrong userid & password or you are attempting to connect to the wrong db.

If you have access to the server that the db runs on you can test your credentials using Progress' sqlexp command line tool:

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

Or you could use any popular Windows based SQL querying tool to try the connection...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM