Topic
  • 1 reply
  • Latest Post - ‏2013-05-21T16:56:19Z by markevans
3UPQ_Mohamed_Sithik
3UPQ_Mohamed_Sithik
1 Post

Pinned topic EGL Connect to AS400 Distributed Database

‏2013-05-20T08:10:44Z |

Hi

I have an EGL WebServices project using RAD/RBDe 8.0.3, My requirment is to connect more than one AS400 ditributed database based on user inputs, I have defined one basic connection thru JNDI, connection to base database, from there I need to switch/connect to other data bases based on inputs.

SqlLib.connect("jdbc/Dev", "userid", "paswrd");

getCustomer1 with

#sql{

selectACONM,ACCA1, ACCA2, POBOX, TOWN, Sarea

fromFLLIB02.ACCNAM

whereAconr = 119 andbrnbr = 1 };

After that I need to connect to other DB

SqlLib.connect("jdbc:as400:JH", "user", "pwd");

getcu040c1 with

#sql{

selectCRNUMH,

ZIPCDE,

FAXNO ,

CUNTRY,

PROVIN,

ACCTYP,

MOBILE,

WEBADR

fromfllib02.CU040

whereAconr = 119 andbrnbr = 1 };

While running the webservices, it says as

EGL0505E Cannot connect to jdbc:as400:JH: Name "comp/env/jdbc:as400:JH" not found in context "java:".

EGL0002I The error occurred in CustomerDetails processing the GetCustomerDetails function.

Can anyone pls help me and treat this request as urgent.

Mohamed Sithik

 

 

  • markevans
    markevans
    2806 Posts

    Re: EGL Connect to AS400 Distributed Database

    ‏2013-05-21T16:56:19Z  

    Mohamed contacted me offline as well, but wanted to post the answer here in case others need it. 

    When running under as a web service, it is running in a J2EE context.   This means the sqllib.connect needs to specify a JNDI name in all cases as it will be accessing the data via a datasource.

     

    So, a separate datasource needs to be configured for the JH database (for example jdbc/JH) and the associated JNDI name would be specified in the sqllib.connect statement.