[Mono-list] problem with myodbc

danilo lujambio danilo@tau.org.ar
19 Aug 2003 08:15:25 -0300


El mar, 19-08-2003 a las 05:37, Gustavo Ramos escribió:
Thanks Gustavo , but it didn't work.

With your sintaxis I can connect to Mysql using bytefx

Thanks again

Danilo 

> Hello,
> 
> Try with this connection string (I've changed "UID" by "USER ID" and
> "OPTION=3" by "OPTION=2204":
> 			dbcon.ConnectionString =
> 				"DRIVER={MySQL};" +
> 				"SERVER=localhost;USER ID=usuario;Password=clave;" +
> "DATABASE=midatabase";
> 				"OPTION=2204";
> 
> I am almost sure it happened because you used "UID" instead "USER ID".
> 
> Regards,
> 
> Eureko
> 
> -----Mensaje original-----
> De: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com]En nombre de danilo lujambio
> Enviado el: Domingo, 17 de Agosto de 2003 09:57 p.m.
> Para: mono-list@lists.ximian.com
> Asunto: [Mono-list] problem with myodbc
> 
> 
> Hi,
> 
> I have worked with myodbc with C# but I didn't have good results
> 
> I passed some steps that I read from lists ( like link libodbc32 to
> liobdbc , etc ) and I am working with the code from
> System.Data/Test/Odbc.Test.cs .
> 
> Now I have an error about authentication on database, the user is OK and
> the password is OK , I suspect that the connection string is wrong but I
> could not find the error. My code is :
> 
> using System;
> using System.Data;
> using System.Data.Odbc;
> 
> namespace Test.OdbcTest
> {
> 	class OdbcTest
> 	{
> 		[STAThread]
> 		static void Main(string[] args)
> 		{
> 			OdbcConnection dbcon = new OdbcConnection();
> 			dbcon.ConnectionString =
> 				"DRIVER={MySQL};" +
> 				"SERVER=localhost;UID=usuario;Password=clave;" +				"DATABASE =
> midatabase";
> //				"OPTION=3";
> 
> 			// connection string that uses a DSN.
> //			dbcon.ConnectionString =
> //				"DSN=LocalServer;UID=root;PWD=AA4Tmc";
> 
> 			dbcon.Open();
> 
> 			OdbcCommand dbcmd = new OdbcCommand();
> 			dbcmd.Connection = dbcon;
> 			dbcmd.CommandType = CommandType.Text;
> 			dbcmd.CommandText = "SELECT * FROM Cabinas";
> 
> 			OdbcDataReader reader;
> 			reader = (OdbcDataReader) dbcmd.ExecuteReader();
> 
> 			while(reader.Read()) {
> 				Console.WriteLine("Last Name: " + reader[0].ToString());
> 			}
> 			reader.Close();
> 			dbcmd.Dispose();
> 			dbcon.Close();
> 		}
> 	}
> }
> 
> the error is :
> 
> Unhandled Exception: System.Data.Odbc.OdbcException:
> [unixODBC][TCX][MyODBC]Access denied for user: 'danilo@localhost' (Using
> password: NO)
> in <0x004a1> 00 System.Data.Odbc.OdbcConnection:Open ()
> in <0x00054> 08 System.Data.Odbc.OdbcConnection:Open ()
> in <0x00059> 00 Test.OdbcTest.OdbcTest:Main (string[])
> 
> (I verified the user and password with mysql -u  user -p , etc)
> 
> can anybody help me ? or can anybody give me a working example ?
> 
> Thanks in advance !
> 
> danilo
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list