Search found 10 matches

by gustavp
Thu 25 Aug 2011 08:29
Forum: dotConnect for Oracle
Topic: OracleConnection.ClientId?
Replies: 7
Views: 11116

My implementation, very much a copy pastejob of the above solution.

I can't set clientid if the connection is closed, so I have to do it when the state is changed to open.

If I use the builtin clientid = "something" the connection on the context unexpectedly changes to closed...(?)

Code: Select all

namespace MyProject.Models
{
    public partial class DataContext
    {
        partial void OnContextCreated()
        {
            if ( null == this.Connection ) return;

            this.Connection.StateChange += Connection_StateChange;
        }
        private EntityConnection EntityConnection
        {
            get { return this.Connection as EntityConnection; }
        }
        private OracleConnection OracleConnection
        {
            get { return this.EntityConnection.StoreConnection as OracleConnection; }
        } 
        private void Connection_StateChange( object sender, StateChangeEventArgs e )
        {
            if ( e.CurrentState != ConnectionState.Open ) return;

            OracleConnection conn = this.OracleConnection;
            if ( null == conn ) return;

            //closes connection on DataContext (bug?), and passes closed/broken connection 
            //conn.ClientId = HttpContext.Current == null ? "Anonymous" : HttpContext.Current.Profile.UserName;

            //working solution
            string identity = HttpContext.Current == null ? "Anonymous" : HttpContext.Current.Profile.UserName;
            OracleCommand cmd = conn.CreateCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DBMS_SESSION.SET_IDENTIFIER";
            cmd.Parameters.Add( new OracleParameter { ParameterName = "client_id", Value = identity } );
            cmd.ExecuteNonQuery();
            cmd.Dispose();

            return;
        }

        protected override void Dispose( bool disposing )
        {
            if ( null != this.Connection )
                this.Connection.StateChange -= Connection_StateChange;

            base.Dispose( disposing );
        }
    }
}

by gustavp
Thu 18 Aug 2011 13:13
Forum: dotConnect for Oracle
Topic: OracleConnection.ClientId?
Replies: 7
Views: 11116

The only problem is, that OracleConnection.ClientId actually closes the connection again, so the connectionstate is Closed/Invalid when the context is created.
The solution remains to set the identifier manually.
by gustavp
Tue 09 Aug 2011 11:44
Forum: dotConnect for Oracle
Topic: case insensitive searching
Replies: 4
Views: 2034

Wouldn't it be easier to create a functional index in your DB (not even required, but faster for searching), and use the UPPER() function in you query?

some pseudo code to explain:
string somestring = "somestring";
string query = "select * from sometable where upper(somecolumn) = :bind";
Bindings bind = db.bind(":bind",somestring.ToUpper());
db.prepare(query, bind);
ResultSet restult = db.select();
by gustavp
Mon 08 Aug 2011 14:10
Forum: dotConnect for Oracle
Topic: Mono - getting assembly error with Devart.Data.Oracle.Web
Replies: 8
Views: 3512

Shalex wrote:1. Sorry, but we have not received your e-mail. Please resend the test project again (include your global *.config files - we will try to recreate your environment) to http://www.devart.com/company/contact.html.
I have sent another request via the form.
Shalex wrote: 2. If possible, make sure that Devart.Data.Oracle.Web.dll of the corresponding version is loaded in the process of your application when these errors occur.
I believe it is loaded. The Membershipprovider works after a few errors, and the errors do not come back until I restart apache, or touch the web.config file.
Shalex wrote: 3. Refer to http://stackoverflow.com/questions/1248 ... mbly-error (maybe this will give an idea what can be wrong).
I searched the server for any devart files. the few I found, I promptly deleted. The problem persists.
Shalex wrote: 4. Try adding registration for Devart Personalization and Web Event providers in the web.config of your application (http://www.devart.com/dotconnect/oracle ... iders.html). Does it help?
This doesn't seem to fix the problem. :-(

I hope you get my email this time.

Thanks.

/Gustav
by gustavp
Mon 08 Aug 2011 09:25
Forum: dotConnect for Oracle
Topic: Mono - getting assembly error with Devart.Data.Oracle.Web
Replies: 8
Views: 3512

Shalex wrote: Make sure that there are no Devart providers registrations in the <system.web><webParts><personalization> and <system.web><healthMonitoring> sections in your application's web.config and global web.config (\etc\mono\_version_\web.config). If this doesn't help, please send us a small test project to reproduce the issue in our environment.
I did this last week, Wednesday, but I have yet received only a confirmation reply. I attached a small test solution, and a link to this thread which describes the problem.
There are no references to webparts or personalizationprovider (and have never been, I have never used these).
I have looked in all config files on the server.
Shalex wrote: This is not the case.
Ok, didn't think so but thanks anyway, then that is out of the way.
Shalex wrote: As licensing cannot be done directly under Mono, the license resource should be generated on Windows and added to the project on Linux as an embedded resource: http://www.devart.com/dotconnect/oracle ... ml#compile.
I did that already, the licenses.licx I added because of frustration.

Shalex wrote:Mono v 2.10.2. Tried ASP.NET v 2.0 and 4.0.
Hm, ok...mine is 2.10.1, running MVC3 on 4.0

update:
I am now running it on mono 2.10.2
Version information: Mono Runtime Version: 2.10.2 (tarball Mon Apr 18 19:06:50 UTC 2011); ASP.NET Version: 4.0.30319.1

I can resend the test project again, if you didn't receive it for some reason.
I can also provide my global web.config, machine.config and everything else you might want to look at.
by gustavp
Wed 03 Aug 2011 08:16
Forum: dotConnect for Oracle
Topic: Mono - getting assembly error with Devart.Data.Oracle.Web
Replies: 8
Views: 3512

still getting the strange error

Shalex wrote:I cannot reproduce the problem in our environment (Mono v 2.10.2). I have used the following Membership provider registration in web.config:

Code: Select all

<configuration>
  <connectionStrings>
      <clear/>
      <add name="OracleServices" connectionString="Direct=true;server=IP_address;sid=***;User Id=***;Password=***;"/>
   </connectionStrings>
  <system.web>
    ...
    <membership defaultProvider="AspNetOracleMembershipProvider" userIsOnlineTimeWindow="15">
         <providers>
            <clear/>
            <add name="AspNetOracleMembershipProvider" type="Devart.Data.Oracle.Web.Providers.OracleMembershipProvider, Devart.Data.Oracle.Web, Version=6.30.196.0, Culture=neutral, PublicKeyToken=09af7300eec23701" connectionStringName="OracleServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10"/>
         </providers>
      </membership>
  </system.web>
</configuration>
The project type is ASP.NET Web Application. The Devart.Data.dll, Devart.Data.Oracle.dll, Devart.Data.Oracle.Web.dll assemblies are placed in the bin folder of application. As licensing cannot be done directly under Mono, the license resource was generated on Windows and added to the project on Linux as an embedded resource: http://www.devart.com/dotconnect/oracle ... ml#compile.
Also please refer to http://www.devart.com/dotconnect/oracle ... iders.html.

If this doesn't help, please send us a small test project to reproduce the issue in our environment.
My project is an MVC3 Web Application.
I just upgraded to 196 (formerly 185).
I still have the problems.

I can use the membershipprovider fine, but only when I have updated the page a few times, getting first
error #1)

Code: Select all

Could not load type 'Devart.Data.Oracle.Web.Providers.OraclePersonalizationProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.196.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.
secondly
error #2)

Code: Select all

Could not load type 'Devart.Data.Oracle.Web.Providers.OracleWebEventProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.196.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.
After this, the page runs as expected until I restart Apache.
My connectionstring looks like this:

Code: Select all

<add name="app2Connection"
         connectionString="User Id=xxx;Password=xxx;Server=xxx;Home=orahome;Connection Lifetime=10;Validate Connection=True;Direct=True;Statement Cache Size=5000;Sid=xxx;Persist Security Info=True;Clientid=app2_Anonymous;" />
Membershipprovider:

Code: Select all

<membership defaultProvider="AspNetOracleMembershipProvider">
      <providers>
        <clear/>
        <add name="AspNetOracleMembershipProvider"
             type="Devart.Data.Oracle.Web.Providers.OracleMembershipProvider, Devart.Data.Oracle.Web, Version=6.30.196.0, Culture=neutral, PublicKeyToken=09af7300eec23701"
             connectionStringName="app2Connection"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             requiresUniqueEmail="true"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             applicationName="xxx" />
      </providers>
    </membership> 
I don't think it's a connection issue though, I can connect to the database - no problems, and the membershipprovider works fine.

I don't get any license errors, but could this be the issue?
I have a licenses.licx in the project, and everything else seems to work, except for the 2 errors described above.

I will send you a test project if you still have no idea what could cause this problem.

By the way, what version of mono are you running?

Mine is

Code: Select all

Version information: Mono Runtime Version: 2.10.1 (tarball Wed Feb 23 20:24:55 UTC 2011); ASP.NET Version: 4.0.30319.1 
by gustavp
Mon 01 Aug 2011 07:22
Forum: dotConnect for Oracle
Topic: Mono - getting assembly error with Devart.Data.Oracle.Web
Replies: 8
Views: 3512

Re: Mono - getting assembly error with Devart.Data.Oracle.Web

gustavp wrote:Every time I try to use providers with Oracle on Mono, I get errors.
It happens as soon as I add Devart.Data.Oracle.Web to the project.

Even though I have no use for OraclePersonalizationProvider and OracleWebEventProvider, I get these errors.

Furthermore, It doesn't seem like my the MembershipProvider works properly, this might be connected.

I get the following error:

Server Error in '/' Application
Could not load type 'Devart.Data.Oracle.Web.Providers.OraclePersonalizationProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.185.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.

Description: HTTP 500. Error processing request.

Stack Trace:

System.TypeLoadException: Could not load type 'Devart.Data.Oracle.Web.Providers.OraclePersonalizationProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.185.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.
at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)
at System.Type.IsAssignableFrom (System.Type c) [0x00096] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System/Type.cs:885
at System.Web.Mvc.AreaRegistration.IsAreaRegistrationType (System.Type type) [0x00000] in :0
at System.Web.Mvc.TypeCacheUtil+c__DisplayClass1.b__0 (System.Type type) [0x00000] in :0
at System.Linq.Enumerable+c__Iterator35`1[System.Type].MoveNext () [0x00059] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/System.Core/System.Linq/Enumerable.cs:3010
at System.Collections.Generic.List`1[System.Type].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Collections.Generic/List.cs:126
at System.Collections.Generic.List`1[System.Type]..ctor (IEnumerable`1 collection) [0x0002f] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Collections.Generic/List.cs:63
at System.Linq.Enumerable.ToList[Type] (IEnumerable`1 source) [0x00006] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/System.Core/System.Linq/Enumerable.cs:2847
at System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies (System.String cacheName, System.Predicate`1 predicate, IBuildManager buildManager) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas (System.Web.Routing.RouteCollection routes, IBuildManager buildManager, System.Object state) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas (System.Object state) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas () [0x00000] in :0
at Pricespy.MvcApplication.Application_Start () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:226

Version information: Mono Runtime Version: 2.10.1 (tarball Wed Feb 23 20:24:55 UTC 2011); ASP.NET Version: 4.0.30319.1

Edit:
I am using the newest version of dotConnect for Oracle (pro edition).
By the way, the project works under mono if I press F5 a few times, but every time i restart apache, I get the errors until I have reloaded the page 3 times. It seems very strange that all other provider work fine, but mono complains about these 2 missing assemblies.

I can provide a test solution, but it will only be reproduceable on a mono server.
by gustavp
Fri 29 Jul 2011 13:21
Forum: dotConnect for Oracle
Topic: Oracle Clientid
Replies: 11
Views: 4252

Shalex wrote: All connections in the same pool have the same connection string. Could you please describe the problem you have encountered with the client ID and connection pooling?
I don't have problems, I was just wondering how it works across the pool, if different users draw connections from the same pool.
Shalex wrote: For example, you can assign HttpContext.User.Identity.Name to OracleConnection.ClientId in the handler of the Login.LoggedIn event.
I was looking for something like that.
Thanks I will test it as soon, and give feedback.

Edit:
Hm now I can't even get the quoting to work.
by gustavp
Thu 28 Jul 2011 09:05
Forum: dotConnect for Oracle
Topic: Mono - getting assembly error with Devart.Data.Oracle.Web
Replies: 8
Views: 3512

Mono - getting assembly error with Devart.Data.Oracle.Web

Every time I try to use providers with Oracle on Mono, I get errors.
It happens as soon as I add Devart.Data.Oracle.Web to the project.

Even though I have no use for OraclePersonalizationProvider and OracleWebEventProvider, I get these errors.

Furthermore, It doesn't seem like my the MembershipProvider works properly, this might be connected.

I get the following error:

Server Error in '/' Application
Could not load type 'Devart.Data.Oracle.Web.Providers.OraclePersonalizationProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.185.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.

Description: HTTP 500. Error processing request.

Stack Trace:

System.TypeLoadException: Could not load type 'Devart.Data.Oracle.Web.Providers.OraclePersonalizationProvider' from assembly 'Devart.Data.Oracle.Web, Version=6.30.185.0, Culture=neutral, PublicKeyToken=09af7300eec23701'.
at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)
at System.Type.IsAssignableFrom (System.Type c) [0x00096] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System/Type.cs:885
at System.Web.Mvc.AreaRegistration.IsAreaRegistrationType (System.Type type) [0x00000] in :0
at System.Web.Mvc.TypeCacheUtil+c__DisplayClass1.b__0 (System.Type type) [0x00000] in :0
at System.Linq.Enumerable+c__Iterator35`1[System.Type].MoveNext () [0x00059] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/System.Core/System.Linq/Enumerable.cs:3010
at System.Collections.Generic.List`1[System.Type].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Collections.Generic/List.cs:126
at System.Collections.Generic.List`1[System.Type]..ctor (IEnumerable`1 collection) [0x0002f] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Collections.Generic/List.cs:63
at System.Linq.Enumerable.ToList[Type] (IEnumerable`1 source) [0x00006] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/System.Core/System.Linq/Enumerable.cs:2847
at System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies (System.String cacheName, System.Predicate`1 predicate, IBuildManager buildManager) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas (System.Web.Routing.RouteCollection routes, IBuildManager buildManager, System.Object state) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas (System.Object state) [0x00000] in :0
at System.Web.Mvc.AreaRegistration.RegisterAllAreas () [0x00000] in :0
at Pricespy.MvcApplication.Application_Start () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /usr/src/redhat/BUILD/mono-2.10.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:226

Version information: Mono Runtime Version: 2.10.1 (tarball Wed Feb 23 20:24:55 UTC 2011); ASP.NET Version: 4.0.30319.1

Edit:
I am using the newest version of dotConnect for Oracle (pro edition).
by gustavp
Wed 27 Jul 2011 07:49
Forum: dotConnect for Oracle
Topic: Oracle Clientid
Replies: 11
Views: 4252

Client id

How do I use the client ID?
I would like to somehow add the client ID to the connectionstring in web.config so I don't have to set the clientid every time I use a connection (and how does this work with connection pooling?)

I can insert ClientId into the connectionstring, but I need to be able to pass httpcontext.user.identity.name to the connectionstring. How do I go about that?

my connectionstring looks something like this:
web.config:

...




...