AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Netbeans and Datasources

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
JT
Guest





PostPosted: Wed Sep 06, 2006 8:12 pm    Post subject: Netbeans and Datasources Reply with quote



I am using netbeans 5.0 ide. I am running everything on the tomcat
bundled with Netbeans5.0 in test mode. I setup a resource name in the
project context.xml as such:

<Context path="/WebApplication1" debug="5" reloadable="true"
crossContext="true">
<Resource name="jdbc/MYSID" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="mypass" password="mypass123"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:myname/mypass (AT) 192 (DOT) 168.1.231:1521:mysid"/>
</Context>


My servlet is as such:

Context initContext = new InitialContext();
Context envContext =
(Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/MYSID");
conn = ds.getConnection();
....

I loaded the oracle class12.jar as a lib in the Libraries section.


When I run the servlet I get:
State : null
Message: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
Error : 0


Although the servlet works when I access jdbc direct without using a
"datasource":

//Class.forName("oracle.jdbc.driver.OracleDriver" ).newInstance() ;

//Get a connection to the database
//conn = DriverManager.getConnection( "jdbc:oracle:thin: ....

Thanks
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.