This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes JDBC/Servlets question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "JDBC/Servlets question" Watch "JDBC/Servlets question" New topic
Author

JDBC/Servlets question

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 602

Hi all,
I found the following code online...I would like to know why it is throwing a nullpointer exception..I have installed mysql and created a products database as well as a Product table....Please help,I want to use the JSTL <c:sql> tags but I first need to get mySQL up and running...




Except the only difference in mine is that I have different parameters for this:
DriverManager.getConnection("jdbc:mysql://localhost:3036/products","myusername","mypassword");


I don't have the JDBC driver installed though,mySQL site keeps on asking me to enter the same information....
Which version of the JDBC driver must I download??I understand it must go in {$CATALINA_HOME}\common\lib???


===>SCJP 1.5(72%)<===
==>SCWCD1.5(76%)<===
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2543
    
  10

I would like to know why it is throwing a nullpointer exception
Can you tell us at what point the exception occurs, and give us the error details?


OCUP UML fundamental and ITIL foundation
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 602

I edited my first post to highlight some changes in the code that I used...Also I ask about some information on JDBC driver type/and where it must go...
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874




don't have the JDBC driver installed though,mySQL site keeps on asking me to enter the same information....
Which version of the JDBC driver must I download??I understand it must go in {$CATALINA_HOME}\common\lib???


You can download the JDBC driver jar from here . Also check if the versions match with MySql DB.

Yes , it can go inside common/lib.
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 602

Does this output from javaDB's sysinfo.bat mean that I don't need to install the JDBC connector??

--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[C:\Sun\SDK\javadb\lib\derby.jar] 10.4.2.1 - (706043)
[C:\Sun\SDK\javadb\lib\derbytools.jar] 10.4.2.1 - (706043)
[C:\Sun\SDK\javadb\lib\derbynet.jar] 10.4.2.1 - (706043)
[C:\Sun\SDK\javadb\lib\derbyclient.jar] 10.4.2.1 - (706043)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JDBC/Servlets question
 
It's not a secret anymore!