Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 20th, 2003, 07:51 AM
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataSource, Oracle...

Hi, all

last few days i tried to make connection on database through connection pool.
the code i used is:

String error = null;
    error = "Setting property...";
    java.util.Properties params = new java.util.Properties();
    params.setProperty(Context.INITIAL_CONTEXT_FACTORY ,
                                 "com.ibm.websphere.naming.WsnInitialContextFactory ");

    error = "Initializing InitialContext...";
javax.naming.Context ctx = new javax.naming.InitialContext(params); //here is error
    error = "getting DataSource...";
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/myDS");

    error = "getting connection...";
    java.sql.Connection conn = ds.getConnection(username, password);
    System.out.println("DataSource works!!");
catch (Exception e){
    System.out.println(error + e);
i used variable error to detect where is problem.

when i start this application on Websphere server 4.0 i got following exception:

Initializing InitialContext...

Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory
[Root exception is java.lang,ClassCastException]

if you have some ideas, or you have sollution,
please help.


Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
call oracle function using oracle link server vl SQL Server 2000 1 July 12th, 2007 08:19 AM
Object datasource VS DataSource SoftMind BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 July 27th, 2006 10:44 PM
How to Read Oracle Data without Oracle being insta badrinarayanang Oracle 1 October 6th, 2005 06:34 AM
How to configure XA-DataSource for Oracle in JBoss keseln J2EE 0 September 24th, 2003 09:42 AM
How to configure XA-DataSource for Oracle in JBoss keseln Wrox Book Feedback 1 September 24th, 2003 09:15 AM

All times are GMT -4. The time now is 01:27 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.