Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 13th, 2001, 04:27 AM
otsche otsche is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Germany
Posts: 0 otsche User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
JSP cannot connect to MySQL Server

Hi,
I am trying to connect to a MYSQL Server (not localhost)
and I'm able to connect via MySQL Gui, no problem.

But when trying to connect via JSP code, I get the following error
message

java.sql.SQLException: Server configuration denies access to data source
at org.gjt.mm.mysql.MysqlIO.init(Compiled Code)
at org.gjt.mm.mysql.Connection.connectionInit(Compiled Code)
at org.gjt.mm.mysql.jdbc1.Connection.connectionInit(Compiled Code)
at org.gjt.mm.mysql.Driver.connect(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)

I'm using this code...

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

conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +pass;

Connection Conn = DriverManager.getConnection(conn);


Could the problem be JDBC related? I would be very glad if
someone could help. Thanx in advance

otsche

Reply With Quote
  #2  
Old September 26th, 2001, 06:29 AM
jim_dewit jim_dewit is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 1 jim_dewit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just a possibility, have you edited your mySQL host tables to allow access from an outside source(not localhost)?

Reply With Quote
  #3  
Old October 8th, 2001, 12:12 PM
winstonralph winstonralph is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Posts: 10 winstonralph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am getting exactly the same error and don't know how to fix it, so if you have since rectified it can you post up here??
Thanks
Winston

Reply With Quote
  #4  
Old October 18th, 2001, 06:57 AM
otsche otsche is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Germany
Posts: 0 otsche User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok, guys thanks for your help.

it was just as jim_dewit said,

the problem was that jdbc/mysql connection (mm.mysql)
was not properly configured. suprisingly, in the connection string
in the jsp file
i also had to use "localhost" as the host and not the ip address of the mysql - server.

a sample of the code that works...
// database parameters for all .jsp pages
String host="localhost";
String user="test";
String pass="";
String db="test";
String conn;

Class.forName("org.gjt.mm.mysql.Driver");

conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +
pass;
Connection Conn = DriverManager.getConnection(conn);

Statement SQLStatement2 = Conn.createStatement();
String Query = "SELECT username,password FROM user WHERE username='"+username+"' AND password='"+password+"'";
ResultSet SQLResult2 = SQLStatement2.executeQuery(Query);

while (SQLResult2.next())
{
saved_pass = SQLResult2.getString("password");
saved_user = SQLResult2.getString("username");

}


SQLResult2.close(); SQLStatement2.close();
Conn.close();


thx for your help
so far
otsche

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > JSP cannot connect to MySQL Server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway