[Mono-devel-list] Exception using ASP.NET (XSP) and OleDb cla ss

Gomez Aragoneses, Andres agomez at wke.es
Wed Sep 15 07:18:11 EDT 2004


Hello Simon. Thank you for your quick responses! I finally succeeded!

When your email has arrived, I had just solved the problem (I found this URL
about:
http://lists.ximian.com/archives/public/mono-list/2004-April/019795.html).

However, it seems that the code example that is on
http://www.go-mono.com/odbc.html is buggy! (perhaps the person who wrote it
didn't compile it!). I think the following changes should be done:

[Original]
...
IDbConnection dbcon;
dbcon.Open();
dbcon = new OdbcConnection(connectionString);
...

[Proposed]
...
IDbConnection dbcon = new OdbcConnection(connectionString);
dbcon.Open();
...


Also it would be a nice thing to mention on that page to use
"-r:System.Data" and not to use "-r:System.Data.Odbc" when using the
compiler. To whom should I notify these suggestions?

	Regards,

		Andrew


-----Mensaje original-----
De: Simon Bain [mailto:sibain at tendotzero.com]
Enviado el: miércoles, 15 de septiembre de 2004 13:02
Para: Gomez Aragoneses, Andres
CC: mono-devel-list at lists.ximian.com
Asunto: RE: [Mono-devel-list] Exception using ASP.NET (XSP) and OleDb class


Andres Hi.
Yep you should be able to. I have not used Oracle but ODBC no problems.
Your error message is due to the compiler not knowing that the assemby is
required. 

If you look at the lines bellow you will see what command I have just ran to
compile an ODBC app. (Web in this case)

mcs /t:library /out:XmlOpenUI.dll -r:System.Data -r:System.Drawing
AssemblyInfo.cs DataConnector.cs XmlOpenUI.aspx.cs Global.asax.cs

The main bit here is   -r:System.Data
This tells the compilere to include teh relevent bits.

All the best
Simon
-- 
Simon Bain 
TENdotZERO 
---------- 
XML Open Conference Speaker:- Data Integration with XML and Mono 
http://www.xmlopen.org 
---------- 
XML 2004 Conference Speaker:- e-Voting 
http://www.xmlconference.org/xmlusa/ 

> Hello. 
> 
> My third try has been ODBC and I again didn't success. 
> 
> My error now is from the compiler: "error CS0006: Cannot find assembly 
> `System.Data.Odbc'". 
> 
> My config file seems correct: 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Of course, I am "using System.Data.Odbc" and calling the compiler with 
> "-r:System.Data.Odbc". And there are no more instructions to get it 
> working 
> in http://www.go-mono.com/odbc.html . 
> 
> Can I really use Mono to develop, on Windows, a program that access to a 
> (Oracle)DB? :o 
> 
> Regards, 
> 
> knocte 
> 
> -----Mensaje original----- 
> De: Simon Bain [mailto:sibain at tendotzero.com] 
> Enviado el: miércoles, 15 de septiembre de 2004 11:40 
> Para: Gomez Aragoneses, Andres 
> Asunto: RE: [Mono-devel-list] Exception using ASP.NET (XSP) and OleDb 
> class 
> 
> 
> Hi. 
> 
> I have also looked and cannot see a gda reference on my win box, so I 
> would 
> assume that this is as yet unavailale. However do not assume that all 
> references are placed in to the config. 
> 
> I found that I had to add an additional odbc32 to the config. odbc was 
> present but the mapping required odbc32 to also be added. 
> 
> All the best 
> Simon 
> -- 
> Simon Bain 
> TENdotZERO 
> ---------- 
> XML Open Conference Speaker:- Data Integration with XML and Mono 
> http://www.xmlopen.org 
> ---------- 
> XML 2004 Conference Speaker:- e-Voting 
> http://www.xmlconference.org/xmlusa/ 
> 
>> Thanks for your comments. 
>> 
>> I haven't found any file with the letters "gda" on my Mono directory, so 
>> I 
> 
>> believe the lib is not available (yet?). And if it existed there, why 
>> wouldn't Mono installation set it by default on the config file? Is this 
>> going to be implemented in the future? Should we submit a bug (RFE) 
>> report 
> 
>> about this? 
>> 
>> I am going to test now the access with ODBC, as you recommend. I will 
>> tell 
> 
>> you when I have the results. 
>> 
>> Regards, 
>> 
>> Andrew 
>> 
>> 
>> -----Mensaje original----- 
>> De: Simon Bain [mailto:sibain at tendotzero.com] 
>> Enviado el: martes, 14 de septiembre de 2004 18:15 
>> Para: Gomez Aragoneses, Andres 
>> CC: mono-devel-list at lists.ximian.com 
>> Asunto: Re: [Mono-devel-list] Exception using ASP.NET (XSP) and OleDb 
>> class 
>> 
>> 
>> 
>> Hi. 
>> 
>> A partial help (sorry not the full). 
>> The message is often due to a dll mapping not being found. If you look 
>> in 
>> the mono config file 
>> Mono Install Directory/etc/mono/config 
>> you will see it there. What you will need to do is map the required dll 
>> to 
> 
>> the linux file. Eg for odbc connections you would normally have to add a 
>> line in the config file like 
>> 
>> 
>> 
>> In this instance you may need (only may) something like 
>> 
>> You will need to get teh correct mapping for the windows file version. 
>> 
>> I hope thsi helps, even if only a little. 
>> 
>> Failing that you could try an ODBC connection, which you will need to 
>> have 
> 
>> unixODBC installed. I have used it with great success and speed across a 
>> range of different databases. It may seem like a backward step from 
>> OleDb 
>> but it does still work well, and there are a lot of drivers available. 
>> 
>> In case you have not used it here is a connection example. 
>> public string callQuery(string strConnection, string strSQL) 
>> { 
>> string strReturn = " > "\">\n"; 
>> OdbcConnection dbcon = new OdbcConnection(strConnection); 
>> try 
>> { 
>> stringFunctions strClass = new stringFunctions(); 
>> dbcon.Open(); 
>> OdbcCommand dbcmd = new OdbcCommand(strSQL,dbcon); 
>> OdbcDataReader sqlreader = dbcmd.ExecuteReader(); 
>> while (sqlreader.Read()){ 
>> //Do something 
>> } 
>> //Carry on 
>> Again I hope that this helps. 
>> 
>> All the best 
>> Simon 
>> -- 
>> Simon Bain 
>> TENdotZERO 
>> ---------- 
>> XML Open Conference Speaker:- Data Integration with XML and Mono 
>> http://www.xmlopen.org 
>> ---------- 
>> XML 2004 Conference Speaker:- e-Voting 
>> http://www.xmlconference.org/xmlusa/ 
>> 
>>> Hello guys. 
>>> 
>>> I am developing an ASP.NET application and I have problems connecting 
>>> to 
>>> the 
>>> database. No compilation errors but I catch this exception: 
>>> 
>>> System.DllNotFoundException: gda-2 in <0x00050> (wrapper 
>>> managed-to-native) 
>>> System.Data.OleDb.libgda:gda_init (string,string,int,string[]) in 
>>> <0x0003e> 
>>> System.Data.OleDb.OleDbConnection:.ctor () in <0x0000a> 
>>> System.Data.OleDb.OleDbConnection:.ctor (string) in <0x00053> (wrapper 
>>> remoting-invoke-with-check) System.Data.OleDb.OleDbConnection:.ctor 
>>> (string) 
>>> in <0x00065> ConexionDB:prueba () 
>>> 
>>> My block of code is: 
>>> 
>>> 
>>> public class ConexionDB { 
>>> 
>>> const string sCon = "DSN=cronos_geac_oracle;PASSWORD=xxxxx;UID=user;"; 
>>> 
>>> public string prueba () { 
>>> 
>>> OleDbConnection oCon; 
>>> 
>>> try { 
>>> oCon = new OleDbConnection(this.sCon); 
>>> } 
>>> catch (Exception e) { 
>>> return e+""; 
>>> } 
>>> 
>>> } 
>>> } 
>>> 
>>> The thing is that I have already found one person that has had my 
>>> problem, 
>> 
>>> but it seems no one replied his message (thread formed by only one 
>>> message): 
>>> 
>>> http://www.mail-archive.com/mono-list@lists.ximian.com/msg09588.html 
>>> 
>>> The unique difference, I think, is that I am on Windows XP and he is on 
>>> Linux. Version of Mono: 1.0.1. 
>>> 
>>> Anyone could comment anything about this? Thanks very much in advance. 
>>> 
>>> -- 
>>> Regards, 
>>> 
>>> Andrew 
>>> _______________________________________________ 
>>> Mono-devel-list mailing list 
>>> Mono-devel-list at lists.ximian.com 
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list 
>>> 
>> 
>> 
>> 
> _______________________________________________ 
> Mono-devel-list mailing list 
> Mono-devel-list at lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-devel-list 
> 



More information about the Mono-devel-list mailing list