• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

properties file fails to load

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run my swing app which connects to an oracle database. It gets the database values (sid, port, etc) from a .properties file. I instantiate a new properties object and then try to load the .properties file from the jar as follows.

Properties p = new Properties();
try {
p.load(getClass().getResourceAsStream("properties/database.properties"));
} catch (IOException ex3) {
System.out.println("IO Error");
}

p.load(InputStream) is recieving a null value and thus not able to collect the database values I need.

I have used jar -tf to make sure the properties file is in the jar and it reads back:

MyPackage/properties/database.properties

I have also tried using the classloader from previous posts but to no avail.

Any Ideas?
 
Scott R.
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will have to sign your jars to allow access to network resources (JDBC connection)
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?



Yup you can connect to the Oracle database using JDBC, or via Datasource.
 
Sudeep Agrawal
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scott R.:
I fix the properties file problem. M

My question is now does the sandbox that JWS runs in allow you to connect to an Oracle database with JDBC?



Yup you can connect to the Oracle database using JDBC, or via Datasource.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Balachandran,
--------------------------------------------------------------------------
I had similar problem where I was loading application specific properties file by using Properties class. It failed. For now, I am passing it as the input arguments to the main method by using the JNLP file. I am just curious, how did you fix your problem?
--------------------------------------------------------------------------

I'm stuckup with reading the input arguments in the main method of the JNLP file....
can u tell me more about how to read these values...if u can paste your class then it would be great..

looking forward for reply.

Thanks
Ved
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic