Results 1 to 2 of 2
- 04-06-2010, 05:53 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 25
- Rep Power
- 0
Problems about connection to a database
Hi!
I've imported a dynamic projects which connects to an old Cloudscape v5.1 database. It works fine, that means the different .jsp pages connect to the database and can work with it.
Now, I want to set up a new dynamic web project and work with the same database. I'm trying to set up a connection (through a datasource), but I always get an error!
Here's the code:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/" + datasourceRef);
con = ds.getConnection();
and the error I get:
Connection exception: Name "comp/env/ClipsAndTacks" not found in context "java:".
Exception thrown: null
java.lang.NullPointerException
I have to admit, that I don't understand anything from the first two rows of the code.
Can someone help/explain me?
I would really appreciate every answer!
Thanks a lot!
- 04-06-2010, 10:21 PM #2
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
You have to learn some basic JNDI
and find a way to configure your environment.
Here is how it is done with Tomcat :
The Tomcat 4 Servlet/JSP Container - JNDI Resources HOW-TO
i hope it will help
cheers!
Similar Threads
-
connection to database
By buston01 in forum JDBCReplies: 4Last Post: 02-21-2010, 01:32 AM -
getting database connection
By ravidasineni in forum AWT / SwingReplies: 1Last Post: 11-22-2009, 02:01 AM -
database connection in jsf
By Srikala in forum JavaServer Faces (JSF)Replies: 0Last Post: 10-06-2008, 06:53 AM -
Database Connection
By CompleteBeginner in forum New To JavaReplies: 2Last Post: 05-24-2008, 02:30 PM -
Database Connection
By vipinkumarsolanki in forum Advanced JavaReplies: 2Last Post: 11-26-2007, 06:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks