I am trying to build a simple query in Java to my Quickbase app and i keep getting this: "ERROR: '' java.lang.RuntimeException: java.lang.NullPointerException".

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Heres my code: 

try {

QuickBaseClient client = new QuickBaseClient("user name", "password", true, "app token");     

Vector i = client.doQuery("_DBID_PRODUCTS", "{3.EX.102423}", null, null, null);

System.out.println(i.firstElement().toString()); 

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

Photo of Jared

Jared

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Eric

Eric

  • 40 Points
The Java constructor now follows a QuickBaseClient(java.lang.String username, java.lang.String password, java.lang.String URL, java.lang.String devkey) argument structure. Your code has true instead of the URL to your application. That's probably the null pointer exception you're experiencing since the object wasn't constructed correctly.
Photo of Eric

Eric

  • 40 Points
Also, try using "" instead of null for the doQuery arguments. Last, are you actually submitting things like "_DBID_PRODUCTS" or is it something like "abcdefgh", whatever the actual dbid is for your table?
Photo of Jared

Jared

  • 0 Points
_DBID_PRODUCTS is the table dbid
Photo of Jared

Jared

  • 0 Points
new error:   com.intuit.quickbase.util.QuickBaseException: This operation is only supported on individual tables and not on the application itself. Please check the URL.

My new code:    try {
QuickBaseClient client = new QuickBaseClient("username", "password", "https://xxxx.com/db/bjpk3fbc5?a=GetAppDevKey", "xxxxxxibj2nnm9dvyytfg4nv3jv");
Vector i = client.doQuery("_DBID_PRODUCTS", "{3.EX.102423}", "", "", "");
System.out.println(i.firstElement().toString());
} catch (Exception e) {e.printStackTrace();}
Photo of Eric

Eric

  • 40 Points
What that means is that you're performing a call against an application's dbid when you should be using the table's dbid. I checked your app and found that bjpk3fbc5 is the app dbid. For the second part, _DBID_PRODUCTS is only a local reference, and as far as I've experienced can't be used in the API/SDK processes. Try putting the actual table dbid there instead and see if it works as expected.
Photo of Jared

Jared

  • 0 Points
I looked for the table ID but that's what i found, I'll look again.
Photo of Eric

Eric

  • 40 Points
For example, your tasks table is bjpk3fb3y
Photo of Jared

Jared

  • 0 Points
is there any way we can chat or talk by phone?
Photo of Jared

Jared

  • 0 Points
or point me to more documentation and examples?
Photo of Eric

Eric

  • 40 Points
The SDKs were made open-source about three and a half years ago, so our team doesn't officially support them. I have some basic experience but I've not coded directly using this SDK.

The official SDK and relevant details can be found here: https://github.com/QuickbaseAdmirer/QuickBase-Java-SDK. You can also search the community forums to see other examples: https://quickbase-community.intuit.com/questions/177566-unable-to-connect-the-quickbase-using-java-sdk or the knowledge base and see what information you can find.