|
-
May 22nd, 2009, 03:51 PM
#1
unable to connect to a mySQL database
I have developed a small JSP application that uses a mySQL database, a single JSP page (which simply displays the contents of a table in my db), and a servlet, which contains the entity manager and sql statements. I link to the database using the xml file (rather than in the code), which contains this:
Code:
...
<properties>
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/baseball8"/>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
<property name="openjpa.ConnectionUserName" value="root"/>
<property name="openjpa.ConnectionPassword" value="password"/>
<property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
</properties>
...
When I access the servlet from a web browser, I get the following error (which is actually quite detailed; last line is the error):
<openjpa-1.2.1-r752877:753278 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-1.2.1-r752877:753278 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/baseball8". You may have specified an invalid URL.
It says my URL is invalid. I KNOW this is the right URL as I have seen it countless places on the net. If I browse to that url in my web browser, I get an octet stream. If I use the command line interface for mysql, it works. If I connect to the sql database using Eclipse, it works. I can connect just fine. I do have the mysql connector in my class path, as well as the opengpl Apache libraries.
I am completely stumped as to the cause of the bug! Any help (or even guesses!) would be greatly appreciated.
Thanks,
Niel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|