2 messages in com.mysql.lists.javaJava & SQL connection problem
FromSent OnAttachments
Alfie Lee21 May 2000 20:46 
Christopher Abney22 May 2000 07:48 
Subject:Java & SQL connection problem
From:Alfie Lee (alfi@acay.com.au)
Date:05/21/2000 08:46:37 PM
List:com.mysql.lists.java

I am running MySQL on a Linux machine that is Samba'd to a Windows 98 notebook. My problem is that I am getting an error: SQLException: Invalid authorization specification: Access denied for user: 'alfie@' (Using password: NO) SQLState: 28000 VendorError: 1045

The program is fairly basic, it's just a trial connection and uses the basic program structure created on the link from MySQL for Java.

import java.sql.*; // Notice, do not import org.gjt.mm.mysql.* // or you will have problems! public class LoadDriver { public static void main(String[] Args) { try { // The newInstance() call is a work around for some // broken Java implementations Class.forName("org.gjt.mm.mysql.Driver").newInstance(); System.out.println("MySQL driver loaded."); } catch (Exception E) { System.err.println("Unable to load driver."); E.printStackTrace(); } try { Connection Conn = DriverManager.getConnection( "jdbc:mysql://192.168.1.2:3306/odle?user=alfie=password"); // Do something with the Connection System.out.print("Got here"); Statement Stmt = Conn.createStatement(); ResultSet RS = Stmt.executeQuery("SELECT * FROM people");

while (RS.next()) { System.out.println(RS.getString(1)); }

// Clean up after ourselves RS.close(); Stmt.close(); Conn.close(); } catch (SQLException E) { System.out.println("SQLException: " + E.getMessage()); System.out.println("SQLState: " + E.getSQLState()); System.out.println("VendorError: " + E.getErrorCode()); } } }

The database exists and I'm fairly sure the privieges granted are okay as they are wilded to the domain. Any ideas?

Regards Alfie