aspose file tools*
The moose likes Applets and the fly likes Iam not able to connect to database using applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Iam not able to connect to database using applets" Watch "Iam not able to connect to database using applets" New topic
Author

Iam not able to connect to database using applets

Nanditha Parripati
Greenhorn

Joined: Jul 20, 2009
Posts: 12
Hi Guys,

I am not able to connect to the database to populate the jTable in JApplets. I had written applet servlet communication program. JApplet is loading in the browser and applet is started. But the data which i want to come from database is not loading. I placed the mysql jar file in tomcat-lib folder. But still iam not able to connect to database. Please help me what i can do.

Thanks,
Nanditha.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42269
    
  64
What does "not able to connect" mean? How are you trying to do that?

You said you have applet/servlet communication in place - so the applet wouldn't connect to the database, it would connect to the servlet, and then the servlet would connect to the database. Which of these parts does or does not work? Are there any error messages in the log files?


Ping & DNS - my free Android networking tools app
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Hi Nanditha

Could you post the messages you are getting in the applet console. Somehow I think you are facing the problem of missing connector.


Copy Paste is a design error!!
Nanditha Parripati
Greenhorn

Joined: Jul 20, 2009
Posts: 12
Hi,

My applet is getting started. Iam not getting any error message in applet console. But the applet is not connected to database when i am running on tomcat. But when i am running as standalone program it is connected to database and getting the values from database. Standalone program i tried in eclipse ide. When iam running from tomcat, I put the project in webapps folder of my tomcat. then it is not able to load the data from the database. I had the mysql.jar file in tomcat lib folder also. But i am getting why the applet is not connecting to database.

Thanks,
Nanditha.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42269
    
  64
Iam not getting any error message in applet console.

That's odd; you are talking about the "Java Console", right?

I had the mysql.jar file in tomcat lib folder also.

Any jar file the applet needs must be in a publicly accessible directory (like the directory where the applet's HTML/JSP file is in), and it must be referenced in the applet tag's "archive" attribute. Otherwise the applet can't use it.
VineetK Singh
Ranch Hand

Joined: Jun 02, 2009
Posts: 47
Hi Nanditha

Find out the jre version your browser is using(Internet Options->Advanced->Java(Sun) in the case of I.E). If you are using only a single version of jre, try moving the connector jar in the path C:\Program Files\Java\jre(x)\lib\ext directory. If you are using multiple versions of jre, move this jar to the version, your browser is using to display the aaplets.

You see, as I presume, eclipse is able to locate the connector as it is added into the classpath. But the browser also needs to be able to access this connector to display the applet correctly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iam not able to connect to database using applets