Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 2nd, 2005, 01:01 AM
Registered User
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connection coudn't be established to the local hos

Hi All,

I am a newbie trying to use MySQL with java.
I tried out the code was found on the following website


I tried to run the compiled program with the mentioned arguments.
I am getting the following error. Could any body help me on this?
Many thanks,


Connection couldn't be established to jdbc:mysql://localhost/test
Exception in thread "main" java.sql.SQLException: Invalid authorization specific
ation message from server: "Access denied for user 'nobody'@'localhost' (using p
assword: NO)"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:1997)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:1906)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java: 2520)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:81 7)
        at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1786)
        at com.mysql.jdbc.Connection.<init>(Connection.java:4 50)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java
        at java.sql.DriverManager.getConnection(DriverManager .java:512)
        at java.sql.DriverManager.getConnection(DriverManager .java:193)
        at TestMySQL.getConnection(TestMySQL.java:66)
        at TestMySQL.test(TestMySQL.java:20)
        at TestMySQL.main(TestMySQL.java:132)
Old February 13th, 2005, 01:42 PM
Authorized User
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts

well... i think it is the problem of the host . it happens when your program runs it tries to eastablish a connection on your computer so 1. whether your connection from sql to your computer is not working or 2. its asking for a host or server. Look at the program where its is assigning the URL with a string (url = "jdbc:mysql://" + host + "/" + database;) here the host is server and you are using your localhost so you can try changing it with the name of your computer.


Similar Threads
Thread Thread Starter Forum Replies Last Post
How this HTML DOM established? Crazy4C Javascript 1 April 16th, 2006 02:00 AM
local character omersharp C# 2005 0 April 9th, 2006 03:29 PM
Runtime error 40006 - After connection established mynameisbill2 Beginning VB 6 1 November 29th, 2003 05:05 AM
Local times pow1983 Forum and Wrox.com Feedback 4 June 9th, 2003 11:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.