Solved

Java Access Provider

  • 31 December 2020
  • 2 replies
  • 233 views

Userlevel 5
Badge +14
  • Hero (Customer)
  • 275 replies

Hi,

I am trying to access from java. I added jar files to libraries. I am getting null pointer exception. What is the problem? 

package javaapplication1;

import ifs.fnd.ap.*;

public class JavaApplication1 {
public static void main(String[] args) {
try {
Server srv = new Server();
srv.setConnectionString("jdbc:oracle:thin:@//192.168.x.xxx.1521/TEST");
srv.setCredentials("ifsapp", "******");
System.out.println();
PlsqlSelectCommand selCmd = new PlsqlSelectCommand(srv, "SELECT IDENTITY, DESCRIPTION FROM FND_USER");
RecordCollection result = selCmd.executeQuery();
System.out.println("All users:");
if (result != null && result.size() > 0) {
RecordIterator itr = result.recordIterator();
Record next;
while (itr.hasNext()) {
next = itr.nextRecord();
System.out.println(" " + next.findValue("IDENTITY") + "\t" + next.findValue("DESCRIPTION"));
}
} else {
System.out.println("No rows selected");
}
} catch (Exception err) {
err.printStackTrace(System.out);
}
}
}

 

 

icon

Best answer by dsj 1 January 2021, 09:44

View original

This topic has been closed for comments

2 replies

Userlevel 7
Badge +20

Hi @hhy38 ,

 

You’ve used the JDBC connection string format which I think is the problem. Change it to

srv.setConnectionString(IFS_URL:PORT)

Java Access Provider connects to IFS through IFS middleware server. Therefore yo need to use the IFS url, not the database connection string.

 

Happy coding!

Damith

 

Userlevel 5
Badge +14

Hi @hhy38 ,

 

You’ve used the JDBC connection string format which I think is the problem. Change it to

srv.setConnectionString(IFS_URL:PORT)

Java Access Provider connects to IFS through IFS middleware server. Therefore yo need to use the IFS url, not the database connection string.

 

Happy coding!

Damith

 

Thank you. The problem has been solved.