• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

JDBC connectivity from applet on WPS 6.1

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to connect to a Sybase database from an applet running on WebSphere Portal Server 6.1. I have signed the jar. I receive this error in the Java Console:

NamingException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Can anyone advise how I can get around this please? Thanks in advance.
 
Rancher
Posts: 43045
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using JNDI to acquire the DB connection? That most likely won't work in an applet, since there's no JEE environment that can provide resources. You'll probably need to use the general JDBC way of obtaining connections.

Is this an intranet application? Otherwise I'd be very concerned about security.
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the response. Yes, this is an intranet portlet application.

I don't understand what you mean by "You'll probably need to use the general JDBC way of obtaining connections."

Here's my current db connection code.
 
Saloon Keeper
Posts: 26534
187
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, I think the applet sandbox expressly forbids JDBC connections. So you'd have to create a signed applet.

Secondly, what you're intending is a 2-tier application. The inadvisability of using a 2-tier architecture was rather graphically demonstrated when the SQL Slammer worm was unleashed.

JDBC opens a port directly into your database server, which makes it a higher risk than if you use an intermediary (3-tier) architecture. I only recommend 2-tier for stuff that's operating entirely inside a firewall.
 
Ulf Dittmer
Rancher
Posts: 43045
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I said, an applet isn't part of the JEE environment, and thus won't be able to get resources (like a DB connection) through JNDI. So you need to open the connection using Class.forName etc., as you would for any old DB connection.
reply
    Bookmark Topic Watch Topic
  • New Topic