Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2006

Tip: Looking for answers? Try searching our database.

context.xml and DataSource

Thread view: 
Aljosa Mohorovic - 28 Nov 2006 23:33 GMT
i'm getting "Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver'"
error but this code works:
working code:

String url = "jdbc:db2://localhost:50000/test";
String user = "user";
String password = "pass";
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection conn = DriverManager.getConnection(url, user, password);
<<<

context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/Test">
   <Resource name="test"
             auth="Container"
             type="javax.sql.DataSource"
             username="user"
             password="pass"
             driverClassName="com.ibm.db2.jcc.DB2Driver"
             url="jdbc:db2://localhost:50000/test"
             />
</Context>
<<<

code not working:

InitialContext ic = new InitialContext();
Context c = (Context)ic.lookup("java:comp/env");

try {
   DataSource ds = (DataSource)c.lookup("test");
   Connection connection = ds.getConnection();
} catch(Exception e) {

   // log e.getMessage();
}
<<<
Juha Laiho - 04 Dec 2006 19:47 GMT
"Aljosa Mohorovic" <aljosa.mohorovic@gmail.com> said:
>i'm getting "Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver'"

... and I wrote a response in another group (clj.help or clj.programmer).

In the future, please crosspost instead of multiposting (and preferably
choose a single group for the followup discussion). This way, your
question will end up as a single message in multiple groups, and all
followup discussion related to your question will be easy to follow in
a single group.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.