Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help for a newbee please!

0 views
Skip to first unread message

Chris Hatton

unread,
Dec 15, 2004, 9:10:46 AM12/15/04
to
I'm having problems trying to connect to a remote mySQL db. I have have
got this working on localhost but can get it to work for my website db.

Can anyone point out problems with the code or general problems I shoudl
be looking out for?

protected Connection getConnection () throws Exception {

String url = "";
String userName = "";
String password = "";
try {
url = "jdbc:mysql://www.tattooplace.co.uk/tattoop_chatusers";
userName = "*******";
password = "*******";
Connection con = DriverManager.getConnection(url, userName,
password);
System.out.println("Connection established to " + url + "...");

return con;
} catch ( java.sql.SQLException e ) {
System.out.println("Connection couldn't be established to " + url);
throw ( e );
}
}

kaeli

unread,
Dec 15, 2004, 9:37:54 AM12/15/04
to
In article <41c045e2$1...@nntphost.cis.strath.ac.uk>,
chris...@blueyonder.co.uk enlightened us with...

> I'm having problems trying to connect to a remote mySQL db. I have have
> got this working on localhost but can get it to work for my website db.
>
> Can anyone point out problems with the code or general problems I shoudl
> be looking out for?

What's the error you're getting?

To see better, more detailed error messages, print out e.getMessage() and do
a e.printStackTrace() here, instead of just rethrowing the error.
For a website, you may need to grab the output stream instead of using
System.out. How to do that depends a bit on whether you're using JSP/beans
(you'd need to pass JSPWriter response in or set a property in the bean or
throw it to a custom error page) or a servlet (you can just write to
response).


> } catch ( java.sql.SQLException e ) {
> System.out.println("Connection couldn't be established to " + url);
> throw ( e );
> }
> }


--
--
~kaeli~
If at first you don't succeed, skydiving is not for you.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Message has been deleted
Message has been deleted

Chris Hatton

unread,
Dec 15, 2004, 11:46:40 AM12/15/04
to
kaeli wrote:

> In article <41c045e2$1...@nntphost.cis.strath.ac.uk>,
> chris...@blueyonder.co.uk enlightened us with...
>
>>I'm having problems trying to connect to a remote mySQL db. I have have
>>got this working on localhost but can get it to work for my website db.
>>
>>Can anyone point out problems with the code or general problems I shoudl
>>be looking out for?
>
>
> What's the error you're getting?
>
> To see better, more detailed error messages, print out e.getMessage() and do
> a e.printStackTrace() here, instead of just rethrowing the error.
> For a website, you may need to grab the output stream instead of using
> System.out. How to do that depends a bit on whether you're using JSP/beans
> (you'd need to pass JSPWriter response in or set a property in the bean or
> throw it to a custom error page) or a servlet (you can just write to
> response).
>
>
>
>> } catch ( java.sql.SQLException e ) {
>> System.out.println("Connection couldn't be established to " + url);
>> throw ( e );
>> }
>> }
>
>

This is the error I am getting but it doesn't mean much to me:

MySQL Driver Found


Connection couldn't be established to

jdbc:mysql://www.tattooplace.co.uk/tattoop
_chatusers

Invalid authorization specification message from server: "Access denied
for user
: 'tattoo...@82-40-66-187.cable.ubr09.uddi.**ueyonder.co.uk' (Using
password
: YES)"

java.sql.SQLException: Invalid authorization specification message from
server:
"Access denied for user:
'tattoo...@82-40-66-187.cable.ubr09.uddi.**ueyonder
.co.uk' (Using password: YES)"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1906)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:954)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1786)
at com.mysql.jdbc.Connection.<init>(Connection.java:450)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:411)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at TestMySQL.getConnection(TestMySQL.java:71)
at TestMySQL.test(TestMySQL.java:20)
at Driver.main(Driver.java:7)
Press any key to continue...

kly...@comcast.net

unread,
Dec 15, 2004, 3:00:01 PM12/15/04
to
I think the problem is probably with access to the site.

Chris Hatton

unread,
Dec 16, 2004, 8:12:46 AM12/16/04
to
kly...@comcast.net wrote:
> I think the problem is probably with access to the site.
>
Got it!!! I never set my access hosts properly, in fact I didn't know
what they where until now <d:-p

thank god for that, I can start to code again now.


Cheers

Chris

0 new messages