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;
}
}