Bug #4837 Not able to access the mysql database on linux system from an JSP application
Submitted: 31 Jul 2004 11:08 Modified: 3 Aug 2004 4:27
Reporter: Madhav Murthy Thotapalli Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.23.54 OS:Linux (RedHat Linux)
Assigned to: Matthew Lord CPU Architecture:Any

[31 Jul 2004 11:08] Madhav Murthy Thotapalli
Description:
Hello folks , i am stuck with an interesting error. I have java (JSP) application accessing mysql database on same linux machine. But when i try to login to the application it throws an exception saying 

<i>Server configuration denies access to data source java.sql.SQLException: Server configuration denies access to data source at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:522) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1734) at com.mysql.jdbc.Connection.<init>(Connection.java:562) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361) </i>

If the same mysql database into a windows based environment . it works fine. Does creation of a mysql database on linux need special privileges? I have granted full permissions to root user using the GRANT ALL command. Can somebody help me out. 

Thanks and Best Regards
Madhav

How to repeat:
I just tried access the database from a java file which i had the following code.

 
 /*
 * @(#) DBManager.java           <Software Version> <Date>
 *
 * COPYRIGHT (C) 2004-2005 Shanta Software Solutions
 * 
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of Shanta Software
 * Solutions. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Shanta Software Solutions.
 *
 * Written by Chandrakala @ shanta software solutions
 *
 *
 *  Date : 15th May 2004
 *
 *  
 */
 

package com.ss.util;

import com.ss.util.*;
import java.sql.*;
import java.io.*;
import java.util.*;

  public class DBManager
  {
  	
  	
  	
  	      	  static Properties trace=null;
              static File fle = null;
		      static FileInputStream fis = null;
              static String dbHost="";
              static String dbDriver="";
              static String dbPort="";
              static String dbSID="";
              static String dbUser="";
              static String dbPassWord="";
              static String dbVendor="";
                
   static
    {
  	   try 
      {
  	  	
  	  	  	    trace = new Properties();
                fle = new File("properties.ini");
		    	fis = new FileInputStream(fle);		
			    trace.load(fis);		
                dbHost=trace.getProperty("HOST");
                dbDriver=trace.getProperty("DRIVER");
                dbPort=trace.getProperty("PORT");
                dbSID=trace.getProperty("SID");
                dbUser=trace.getProperty("USERNAME");
                if(trace.getProperty("PASSWORD")!=null)
   					dbPassWord=trace.getProperty("PASSWORD");
   					
                dbVendor=trace.getProperty("VENDOR");
                
                
  	  	
  	  	 //Driver driver = (Driver)Class.forName("org.gjt.mm.mysql.Driver").newInstance();
  	  	 
  	  	 Driver driver = (Driver)Class.forName(dbDriver).newInstance();
  	  	 DriverManager.registerDriver(driver);
  	  	 
  	  }catch (Exception ex) 
       {
       	  Tracer.ERROR(ex);
  	   }
  		
  	}
  	
  	
  	 
	/* Called from  All .java files to connect to MYSQL DataBase.
	 * 
	 * @returns Connection Object.
	 * 
	 *  This function returns a connection object by reading information from scintera.ini file 
  	 *  which is stored at d:/Apache Group/Tomcat/bin.
  	 *
  	 */
  	
  	  public static Connection getConnection()
	  {
	  	Connection conn=null;
		try
		{
			//conn=DriverManager.getConnection("jdbc:mysql://192.168.1.50:3306/cits","root","");
			
			String dbConnectionString=dbVendor+"://"+dbHost+":"+dbPort+"/"+dbSID;
			
			conn=DriverManager.getConnection(dbConnectionString,dbUser,dbPassWord);
			
		}catch(Exception e)
		 {
		   Tracer.ERROR(e);
		 }	
		 return conn; 
	  }
	  
  }
[3 Aug 2004 4:27] Matthew Lord
Hi Sir,

Thank you for your bug report!

I don't see any bugs from what you've said so far.  Can you add some debugging output to your 
application so that you can see the exact user, host, and password information is being sent to 
the server?  Then you need to try and connect using the same information with the mysql text 
client.  It sounds like you have some account problems.  Make sure that you have a 
root@localhost.localdomain account.
[19 Jan 2008 12:46] Sam Aby
Hi ,
   I have a similar problem.Every thing is working fine in my local machine ie; on 
   windows platform.
   When i uploaded to the hosting provider which runs on linux.i am getting this   
   bug.
   if someone know about this please help me out.