Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Error Message from Server

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I am trying to work with Resin and I am using it's Connection Pool to connect to a database from a Servlet.
Below is the relevent information
resin.conf - <Database>

Servlet - NewPostServlet

web.xml

And when I run this using the following http
http : //localhost : 8081/JBB/Connection (space for smilies)
I get the following error:
General error, message from server: "No Database Selected"
I have used the same Connectin Pool and used JSP - sql syntax to do the exact same thing I am doing in my Servlet and it works just fine. So I am not sure if the problem is my Servlet or my resin.conf file or my web.xml file. It all seems fine to me.
Thanks for any help.
The reason this is in the Resin Forum is because I don't know if it is a Resin problem or not. Move it if it is a Servlet problem.
Thanks.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE
I have determined that the error message is coming from an SQLException so the Driver is returning that message to me. However, I still don't know why. I specified the database in the resin.conf file.
So again, if this needs to be moved....
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE
If I execute a USE dbname command before the query, it works just fine. But I don't understand why I would have to do this. It doesn't seem like I should if the ConnectionPool has already connected to the database n number of times and the connections are just sitting there.
 
Chad McGowan
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's how I have my data source configured in Resin:

I haven't had any problems with this.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sample resin.conf file has the following configuration.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention that I am using the new Resin Beta release. I am going to back off to the current release and see if that makes a difference. In the beta release they have changed their resin.conf a bit. My info reflects these changes.
Thanks for the help.
 
Mariusz Olejnik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use org.gjt.mm.mysql.Driver instead of com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic