Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Help with Remote Data

 
Ranch Hand
Posts: 2038
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to develope a web application. I need to get and post data to several AS400 files. I have created a connection class that works only on a specific file. How can I create a connection class that stores the connection to a variable. Then use this variable in classes that have SQL strings that interact with the AS400 files.

This is my connection class:


I use the LogOnConnection conn = new LogOnConnection(); in a Servlet.

I need to be able to use the connection variable in the following:



However, I get a connot resolve on conn
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not sure if this is more of question for the servlet group ?
Anyway, I think you could use the init method of servlets, something like the following (and use the destroy method to release any resources).
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Where is conn defined? The following code:



creates a local variable which is valid only inside the try.

However, I get a connot resolve on conn



Why do people so frequently leave off critical information? Is that an error from the compiler or from the runtime?

Bill
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic