Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JSP mySql problem

Status
Not open for further replies.

Vix332

Programmer
Mar 13, 2003
1
AU
I am a fairly new web designer and I have my sites hosted on a standard Unix box running Apache - they have enabled tomcat but there seems to be some problem with the jsp talking to mysql I get this error
javax.servlet.ServletException: Server configuration denies access to data source

I can access using Perl but not JSP.
The hosting site is giving me a tap dance about t all saying it is because it is not an NT server they would have to heaps of changes to mysql and it is very complicated Yada Yada - I don't know enough about servers with many sites on them but it all sounds like hogwash to me - any ideas and any suggestions much appreciated
Vix
code
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<%@ page import=&quot;java.sql.*&quot; %>
<%

String name=request.getParameter(&quot;name&quot;);
String phone=request.getParameter(&quot;phone&quot;);
String mobile=request.getParameter(&quot;mobile&quot;);
String email=request.getParameter(&quot;email&quot;);
String design=request.getParameter(&quot;design&quot;);
String graphics=request.getParameter(&quot;graphics&quot;);
String flash=request.getParameter(&quot;flash&quot;);
String registration=request.getParameter(&quot;registration&quot;);
String hosting=request.getParameter(&quot;hosting&quot;);
String content=request.getParameter(&quot;content&quot;);
String comments=request.getParameter(&quot;comments&quot;);

Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;).newInstance();

Connection con;
con = DriverManager.getConnection(&quot;jdbc:mysql://localhost:3306/dbasename&quot;, &quot;username&quot;,&quot;password&quot;);





String sql=&quot;insert into Quotes(name,phone,mobile,email,design,graphics,flash,registration,hosting,content,comments) values(?,?,?,?,?,?,?,?,?,?,?)&quot;;
PreparedStatement pst= con.prepareStatement(sql);
pst.setString(1,name);
pst.setString(2,phone);
pst.setString(3,mobile);
pst.setString(4,email);
pst.setString(5,design);
pst.setString(6,graphics);
pst.setString(7,flash);
pst.setString(8,registration);
pst.setString(9,hosting);
pst.setString(10,content);
pst.setString(11,comments);

pst.executeUpdate();


%>
<H3>Thank you for your information</h3>
</body>
</html>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top