List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:August 16 1999 4:35pm
Subject:Re: jdbc connect
View as plain text  
Stephen Uczekaj wrote:
> 
> I have been using mysql for the last 3 weeks and have had no problems until now.
>  This morning I logged in to my solaris box and started
> mysql-3.22.23b-sun-solaris2.6-sparc, and now the java code below is giving me an
> SQL Exception error 'Server configuration denies access to data source'
> 
> It doesn't matter what I put in for The_Host, The_DB, The_User, The_Pwd I get
> the same error (even when setting The_User/The_Pwd to root)!  The driver is
> org.gjt.mm.mysql.  I can still access mysql through the command line using
> >bin/mysql -u root -p
> 
> Any ideas why this is happening?
> 
> thanks, steve u.
> 
>    public void Connect()
>    {
>       try
>       {
>          Class.forName(The_Driver).newInstance();
>       }
>       catch (Exception e)
>       {
>          System.out.println("Class.forName() Exception: " + e);
>       }
> 
>       try
>       {
>          String connectstr = The_Url + "://" + The_Host + "/" + The_DB + ", " +
> The_User
>  + ", " + The_Pwd;
> 
>          JDBC_Connection = DriverManager.getConnection(connectstr);
>       }
>       catch (java.sql.SQLException e)
>       {
>          System.out.println("\nConnect() SQL Exception: " + e.getMessage() + "\n
> ");
>       }
> 
>    }

Hi Stephen

You use an illegal URL string!
This can't work!!!

Use this instead:
...
        String connectstr = The_Url + "://" + The_Host + "/" + The_DB;
        JDBC_Connection = DriverManager.getConnection( connectstr, The_User, The_Pwd );
...

Tschau
Christian

Thread
jdbc connectStephen Uczekaj13 Aug
  • Re: jdbc connectChristian Mack16 Aug
Re: jdbc connectStephen Uczekaj17 Aug
  • Re: jdbc connectChristian Mack8 Sep