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

data source problem

 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai ,

i am using <data-source> tag to connect mysql.This is my first application using data-source. i tried this small application. i got the error "SERVLET ACTION IS CURRENTLY UNAVAILABLE"

i entered user name.in next page i want to display is password in next page which is in mysql database.


my coding:
In action class:

name1=dataform.getName();
DataSource datasource = getDataSource(request);
Connection myConnection = datasource.getConnection();
rs=stmt.executeQuery("select password from login where name=\""+name1+"\"");
if(rs.next())
{
target="success";
password1=rs.getString("password");
dataform.setPass(password1);
}

in my struts-config


<data-sources>
<data-source
driverClass="org.gjt.mm.mysql.Driver"
password="root"
url="jdbc:mysql://localhost/indigotx"
user="root"/>
</data-sources>

i dont know why the error occurs. plzzz help me to find out the solution.

Thanks in Advance
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the setup that works for me (at least on one machine) is:



you might also want to try using a different jdbc driver

-Tad
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thaku Tad


i Got it. it works fine.thanku for ur help. i changed my jdbc as mysql connector.


thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic