3 messages in com.mysql.lists.javaRe: mm driver
FromSent OnAttachments
Jeremy B. Friedman24 Feb 2000 14:32 
Tim Endres24 Feb 2000 15:10 
Matt Goss25 Feb 2000 06:31 
Subject:Re: mm driver
From:Tim Endres (ti@trustice.com)
Date:02/24/2000 03:10:38 PM
List:com.mysql.lists.java

Try putting the user and password into the properties. This is my code:

public void openConnection() throws SQLException { StringBuffer urlBuf = new StringBuffer();

urlBuf.append( "jdbc:mysql://" );

urlBuf.append( this.host ); if ( this.port != null ) { urlBuf.append( ":" ); urlBuf.append( this.port ); }

urlBuf.append( "/" ); urlBuf.append( this.database );

java.util.Properties info = new java.util.Properties();

if ( this.name != null ) { info.put( "user", this.name ); }

if ( this.pass != null ) { info.put( "password", this.pass ); }

this.openConnection( urlBuf.toString(), info ); }

private void openConnection( String url, Properties info ) throws SQLException { if ( this.isOpen() ) throw new SQLException ( "connection is already open" );

try { this.connection = DriverManager.getConnection( url, info ); this.isOpen = true; } catch ( SQLException ex ) { this.connection = null; throw ex; } }

I've got java servlets working fine with mm driver, but the only user that works is the "nobody" user on the "test" database that is created by default. I've checked the grant tables and all the users I've tried don't seem to work. I don't get any errors, but data is just not pulled from the database (or inserted). Any suggestions? Below are my connection statements:

works fine. C = (Connection) DriverManager.getConnection( "jdbc:mysql://www.myhosthere.com/test?user=nobody");

fails. C = (Connection) DriverManager.getConnection( "jdbc:mysql://www.myhosthere.com/any_other_db?user=not_nobody&password=not_nobody");

-------------------------------------------------------------------- Jeremy Friedman Computer Science Major jere@udel.edu Yearbook Webmaster http://copland.udel.edu/~jeremyf http://www.yearbook.udel.edu

--------------------------------------------------------------------

To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java@lists.mysql.com instead.