Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
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
 
Old March 2nd, 2004, 11:10 AM
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Deuce868
Default connect to mysql problems

I have an existing mysql install set up for php dev.

Server is localhost with db name fame

user is root with pass test

I have added localhost.localdomain to my hosts file

The code I am using is:
Code:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>

<sql:setDataSource var="Source"
                    driver=    "com.mysql.jdbc.Driver"
                    url=    "jdbc:mysql://127.0.0.1/fame"
                    user=    "root" password="test" />

<sql:query var="courses" dataSource="${Source}">
    SELECT CourseNum,ShortDesc FROM coursenum
</sql:query>
The db fields are from my db instead of the test.

At first I was getting an error about not finding the driver for the connection. After a few hours on the net I found a mysql-connector-java.jar from the mysql site that I put in my WEB-INF/lib folder. Now I am getting a different error.
Quote:
quote:root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
I cannot seem to figure out why I can't get this to work and my goodness this is getting frustrating. I was stuck for a while because te jstl library files from the book have different taglib lines and now the mysql driver from jstl just won't work without all this extra hunting around. I am wondering does this much change in JSP in a year?

Thanks for the help.

 
Old March 7th, 2004, 10:50 AM
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Deuce868
Default

Well, I just wanted to share my complete frustration with this. As someone new to JSP I had thought a beginner book would be the way to go. Not only did I run into problems with examples right from the start, but these completely useless forums were no assistance at all. I have returned this book and hopefully the Oreilly 3rd edition will actually be of some use to me.






Similar Threads
Thread Thread Starter Forum Replies Last Post
connect mysql using jsp Nicholsen MySQL 4 February 22nd, 2007 05:27 AM
Trying to connect to Mysql tp194 Classic ASP Databases 4 November 11th, 2004 12:12 AM
Best way to connect to mySQL netdaviso Java Databases 1 April 5th, 2004 06:37 AM





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