Skip to main content
Solved

Java Access Provider

  • Dec 31, 2020 7:05 AM UTC
  • 2 replies
  • 308 views

hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)

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

 

 

Best answer by dsj

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

 

View original
This topic has been closed for replies.

2 replies

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • Answer
  • Jan 1, 2021 8:44 AM UTC

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

 


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • Jan 4, 2021 5:05 AM UTC

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.