[Mono-list] System.DllNotFoundException: oci

Hubert FONGARNAND informatique.internet@fiducial.fr
Tue, 12 Apr 2005 15:23:06 +0200


Hi,
I use System.Data.Oraclient with Oracle InstantClient 10...
I experienced the same problem when I use Oracle Client 9...
I can give you a tip : Use Oracle InstantClient...


Le Mardi 12 Avril 2005 12:53, Gilles FAVIER a =C3=A9crit=C2=A0:
> Hi everybody i am back with ASPX issues...
>
> To make my problem very clear the explanation are not going to be so lo=
ng
> but i will all my code below. I kept as many variable as default to
> simplify the explanation. If any other information is needed to underst=
and
> my problem feel free to ask.
>
> I am running Mono 1.0.6 (installed as root user)with all neede packages=
 and
> i manage without any trouble to display the Mono Sample web pages. I am=
 on
> a Virtual Machine (ran with VMWARE) under RedHat Enterprise Server 3.0 =
and
> i have installed the Oracle Client 9.2.0.4 with all needed packages to =
get
> it to work. ( i can also : "sqlplus XXX/XXX@XXX" and ask some SELECT * =
to
> my base)
>
> 1--
> I can ping my base with "tnsping" as Oracle user. If i use the code
> detailed in test.cs and i compile it with the command line : (as a root=

> user) mcs test.cs /r:System.dll  /r:System.Data.dll=20
> /r:System.Data.OracleClient.dll and then as Oracle user i type :
> mono test.exe
> and i get the expected result.
>
> 2--
> If i take the same code and i put it in webform (see all web code below=
)
> and then i run : mcs /t:library /out:WebTest.dll -r:System -r:System.Da=
ta
> -r:System.Drawing -r:System.Web -r:System.Data.OracleClient AssemblyInf=
o.cs
> Default.aspx.cs Global.asax.cs (I thank again the list for helping me o=
n
> this last one and also Seb Pouliot) then i copy paste everything in the=

> right directory on .../doc/xsp/test and in Firefox i put :
> http://localhost/demo (with the configuration given in the INSTALL of
> mod_mono) I see the first page and when i click on GO, i get the follow=
ing
> error message :
>
> --------------- start ERROR MESSAGE -----------------------
> Description: Error processing request.
>
> Error Message: HTTP 500.
>
> Stack Trace:
>
> System.DllNotFoundException: oci
> in <0x00053> (wrapper managed-to-native) OciNativeCalls:OCIEnvCreate
> (intptr&,System.Data.OracleClient.Oci.OciEnvironmentMode,intptr,intptr,=
intp
>tr,intptr,int,intptr) in <0x00020>
> System.Data.OracleClient.Oci.OciCalls:OCIEnvCreate
> (intptr&,System.Data.OracleClient.Oci.OciEnvironmentMode,intptr,intptr,=
intp
>tr,intptr,int,intptr) in <0x0005d>
> System.Data.OracleClient.Oci.OciEnvironmentHandle:.ctor
> (System.Data.OracleClient.Oci.OciEnvironmentMode) in <0x0003c>
> System.Data.OracleClient.Oci.OciGlue:CreateConnection
> (System.Data.OracleClient.OracleConnectionInfo) in <0x0002b>
> System.Data.OracleClient.OracleConnection:Open ()
> in <0x0004f> (wrapper remoting-invoke-with-check)
> System.Data.OracleClient.OracleConnection:Open () in <0x00094>
> WebTest._Default:BTGO_Click (object,System.EventArgs) in <0x00069> (wra=
pper
> delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs
> (object,System.EventArgs) in <0x00081>
> System.Web.UI.WebControls.Button:OnClick (System.EventArgs) in <0x00058=
>
> System.Web.UI.WebControls.Button:System.Web.UI.IPostBackEventHandler.Ra=
iseP
>ostBackEvent (string) in <0x00016> System.Web.UI.Page:RaisePostBackEvent=

> (System.Web.UI.IPostBackEventHandler,string) in <0x0003e>
> System.Web.UI.Page:RaisePostBackEvents ()
> in <0x002c3> System.Web.UI.Page:InternalProcessRequest ()
> in <0x000c2> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)=

> in <0x002eb> ExecuteHandlerState:Execute ()
> in <0x00084> StateMachine:ExecuteState
> (System.Web.HttpApplication/IStateHandler,bool&) --------------- END ER=
ROR
> MESSAGE -----------------------
>
> What is really weird is that if i take the WebTest.dll and i replace th=
e
> one created by visual studio in my ../siteweb/bin directory ... IT WORK=
S...
> i have the expected answer of my query... Which makes me think that
> according to 1-- i can connect to my base and my tnsnames.ora is good! =
and
> according to 2-- the dll created is working. Why isn't it working under=

> Linux??
>
>
>
> -----------------------------------------------------------------
> --------------------- START CODE test.cs ----------------------
>
>  using System;
>  using System.Data;
>  using System.Data.OracleClient;
>
>  public class Test
>  {
>     public static void Main (string[] args)
>     {
>         string connectionString =3D
>                                 "Data Source=3DXXXX;User
> ID=3DXXXXX;Password=3DXXXXX;"; OracleConnection dbcon =3D null;
>                         dbcon =3D new OracleConnection (connectionStrin=
g);
>                         dbcon.Open ();
>                         OracleCommand dbcmd =3D dbcon.CreateCommand ();=

>                         string sql =3D "SELECT COUNT(*) AS COUNTER FROM=

> T_USER"; dbcmd.CommandText =3D sql;
>                         Console.WriteLine(sql);
>
>                         OracleDataReader reader =3D dbcmd.ExecuteReader=
 ();
>
>                         while(reader.Read())
>                         {
>                         Console.WriteLine((string)
> reader["COUNTER"].ToString()); }
>
>                         reader.Close ();
>                         reader =3D null;
>                         dbcmd.Dispose ();
>                         dbcmd =3D null;
>                         dbcon.Close ();
>                         dbcon =3D null;
>     }
>  }
>
> ------------------ END CODE test.cs------------------------
>
>
> ----------------- START CODE Defalut.aspx ------------------------
> <%@ Page language=3D"c#" Codebehind=3D"Default.aspx.cs" AutoEventWireup=
=3D"false"
> Inherits=3D"WebTest._Default" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTM=
L 4.0
> Transitional//EN" >
> <HTML>
> 	<HEAD>
> 		<title>Default</title>
> 		<meta name=3D"GENERATOR" Content=3D"Microsoft Visual Studio .NET 7.1"=
>
> 		<meta name=3D"CODE_LANGUAGE" Content=3D"C#">
> 		<meta name=3D"vs_defaultClientScript" content=3D"JavaScript">
> 		<meta name=3D"vs_targetSchema"
> content=3D"http://schemas.microsoft.com/intellisense/ie5"> </HEAD>
> 	<body>
> 		<form id=3D"Form1" method=3D"post" runat=3D"server">
> 			<P>
> 				<asp:Label id=3D"LBSQL" runat=3D"server">Label</asp:Label><BR>
> 				<asp:Button id=3D"BTGO" runat=3D"server" Text=3D"GO "></asp:Button>=
</P>
> 			<P>
> 				<asp:Label id=3D"LBResult" runat=3D"server"
> BackColor=3D"#FFFFC0">Label</asp:Label></P> </form>
> 	</body>
> </HTML>
> ----------------- END CODE Default.aspx ------------------------
>
> ----------------- START CODE Defalut.aspx.cs ------------------------
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Web;
> using System.Web.SessionState;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Web.UI.HtmlControls;
> using System.Data.OracleClient;
>
> namespace WebTest
> {
> 	/// <summary>
> 	/// Summary description for _Default.
> 	/// </summary>
> 	public class _Default : System.Web.UI.Page
> 	{
> 		protected System.Web.UI.WebControls.Button BTGO;
> 		protected System.Web.UI.WebControls.Label LBResult;
> 		protected System.Web.UI.WebControls.Label LBSQL;
>
> 		private void Page_Load(object sender, System.EventArgs e)
> 		{
> 			// Put user code to initialize the page here
> 		}
>
> 		#region Web Form Designer generated code
> 		override protected void OnInit(EventArgs e)
> 		{
> 			//
> 			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
> 			//
> 			InitializeComponent();
> 			base.OnInit(e);
> 		}
>
> 		/// <summary>
> 		/// Required method for Designer support - do not modify
> 		/// the contents of this method with the code editor.
> 		/// </summary>
> 		private void InitializeComponent()
> 		{
> 			this.BTGO.Click +=3D new System.EventHandler(this.BTGO_Click);
> 			this.Load +=3D new System.EventHandler(this.Page_Load);
>
> 		}
> 		#endregion
>
> 		private void BTGO_Click(object sender, System.EventArgs e)
> 		{
> 			LBResult.Text =3D "";
> 			LBSQL.Text =3D  "SELECT COUNT(*) AS COUNTER FROM T_USER";
>
> 			string connectionString =3D
> 				"Data Source=3DXXXX;User ID=3DXXXXX;Password=3DXXXXX;";
> 			OracleConnection dbcon =3D null;
> 			dbcon =3D new OracleConnection (connectionString);
> 			dbcon.Open ();
> 			OracleCommand dbcmd =3D dbcon.CreateCommand ();
> 			string sql =3D LBSQL.Text;
> 			dbcmd.CommandText =3D sql;
>
> 			OracleDataReader reader =3D dbcmd.ExecuteReader ();
>
> 			while(reader.Read())
> 			{
> 				LBResult.Text +=3D (string) reader["COUNTER"].ToString() + "<BR>";
> 			}
>
> 			reader.Close ();
> 			reader =3D null;
> 			dbcmd.Dispose ();
> 			dbcmd =3D null;
> 			dbcon.Close ();
> 			dbcon =3D null;
> 		}
> 	}
> }
>
> ----------------- END CODE Defalut.aspx.cs ------------------------
>
> ----------------- START CODE Global.asax------------------------
> <%@ Application Codebehind=3D"Global.asax.cs" Inherits=3D"WebTest.Globa=
l" %>
>
> ----------------- END CODE Global.asax------------------------
>
> ----------------- START CODE Global.asax.cs ------------------------
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Web;
> using System.Web.SessionState;
>
> namespace WebTest
> {
> 	/// <summary>
> 	/// Summary description for Global.
> 	/// </summary>
> 	public class Global : System.Web.HttpApplication
> 	{
> 		/// <summary>
> 		/// Required designer variable.
> 		/// </summary>
> 		private System.ComponentModel.IContainer components =3D null;
>
> 		public Global()
> 		{
> 			InitializeComponent();
> 		}
>
> 		protected void Application_Start(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Session_Start(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Application_BeginRequest(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Application_EndRequest(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Application_AuthenticateRequest(Object sender, EventAr=
gs
> e) {
>
> 		}
>
> 		protected void Application_Error(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Session_End(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		protected void Application_End(Object sender, EventArgs e)
> 		{
>
> 		}
>
> 		#region Web Form Designer generated code
> 		/// <summary>
> 		/// Required method for Designer support - do not modify
> 		/// the contents of this method with the code editor.
> 		/// </summary>
> 		private void InitializeComponent()
> 		{
> 			this.components =3D new System.ComponentModel.Container();
> 		}
> 		#endregion
> 	}
> }
>
>
> ----------------- END CODE Global.asax.cs ------------------------
>
> ----------------- START CODE AssemblyInfo.cs ------------------------
> using System.Reflection;
> using System.Runtime.CompilerServices;
>
>
> [assembly: AssemblyTitle("")]
> [assembly: AssemblyDescription("")]
> [assembly: AssemblyConfiguration("")]
> [assembly: AssemblyCompany("")]
> [assembly: AssemblyProduct("")]
> [assembly: AssemblyCopyright("")]
> [assembly: AssemblyTrademark("")]
> [assembly: AssemblyCulture("")]
>
>
> [assembly: AssemblyVersion("1.0.*")]
>
> [assembly: AssemblyDelaySign(false)]
> [assembly: AssemblyKeyFile("")]
> [assembly: AssemblyKeyName("")]
>
> ----------------- END CODE AssemblyInfo.cs ------------------------
>
> ----------------- START CODE Web.config ------------------------
> <?xml version=3D"1.0" encoding=3D"utf-8" ?>
> <configuration>
>
>   <system.web>
>
>     <!--  DYNAMIC DEBUG COMPILATION
>
>     -->
>     <compilation
>          defaultLanguage=3D"c#"
>          debug=3D"true"
>     />
>
>     <!--  CUSTOM ERROR MESSAGES
>
>     -->
>     <customErrors
>     mode=3D"RemoteOnly"
>     />
>
>     <!--  AUTHENTICATION
>
>     -->
>     <authentication mode=3D"Windows" />
>
> 	<!--  AUTHORIZATION
>
>     -->
>
>     <authorization>
>         <allow users=3D"*" /> <!-- Allow all users -->
>             <!--  <allow     users=3D"[comma separated list of users]"
>                              roles=3D"[comma separated list of roles]"/=
>
>                   <deny      users=3D"[comma separated list of users]"
>                              roles=3D"[comma separated list of roles]"/=
>
>             -->
>     </authorization>
>
>     <!--  APPLICATION-LEVEL TRACE LOGGING
>
>     -->
>     <trace
>         enabled=3D"false"
>         requestLimit=3D"10"
>         pageOutput=3D"false"
>         traceMode=3D"SortByTime"
> 		localOnly=3D"true"
>     />
>
>     <!--  SESSION STATE SETTINGS
>
>     -->
>     <sessionState
>             mode=3D"InProc"
>             stateConnectionString=3D"tcpip=3D127.0.0.1:42424"
>             sqlConnectionString=3D"data
> source=3D127.0.0.1;Trusted_Connection=3Dyes" cookieless=3D"false"
>             timeout=3D"20"
>     />
>
>     <!--  GLOBALIZATION
>
>     -->
>     <globalization
>             requestEncoding=3D"utf-8"
>             responseEncoding=3D"utf-8"
>    />
>
>  </system.web>
>
> </configuration>
>
> ----------------- END CODE Web.config ------------------------
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
_______________________________________________
Ce message et les =E9ventuels documents joints peuvent contenir des infor=
mations confidentielles.
Au cas o=F9 il ne vous serait pas destin=E9, nous vous remercions de bien=
 vouloir le supprimer et en aviser imm=E9diatement l'exp=E9diteur. Toute =
utilisation de ce message non conforme =E0 sa destination, toute diffusio=
n ou publication, totale ou partielle et quel qu'en soit le moyen est for=
mellement interdite.
Les communications sur internet n'=E9tant pas s=E9curis=E9es, l'int=E9gri=
t=E9 de ce message n'est pas assur=E9e et la soci=E9t=E9 =E9mettrice ne p=
eut =EAtre tenue pour responsable de son contenu.