Home

Linqpad and Oracle

It's been awhile for me doing C# reading data from Oracle, but am I going to need the Oracle client installed? I believe not. Also, I guess I'll need to get a hold of a .Net Oracle db access driver. Will I need a certain kind of driver to work in the linq-sql world? I don't mind hand-rolling my own datacontext class. I only have to deal with about 5 tables.

Comments

  • Are you doing all your work from LINQPad? If so, it's easy and you shouldn't need to install the Oracle client. Just download the LINQPad IQ driver (go to Add Connection, View more drivers, IQ driver) and create an Oracle connection using the default direct mode. You can then query Oracle just as you would SQL Server.

    If you want to do this via Visual Studio, you'll need to purchase a third-party product that supports Oracle. DevArt has a product, and there are also products that work with Entity Framework.
  • Was hoping to prototype a script using Linqpad. Then I have a program that compiles scripts on the fly and runs them (much like Linqpad but without any visual UI goodies. All the scripts generate an xml doc). I don't need VS to generate my data context, I'll just hand code it. Can I deploy this IQ driver .dll with my app?
  • I doubt that you'll be able to deploy IQDriver.dll with your app, because it relies on DevArt's commercial ADO.NET drivers which are licensed to LINQPad.

    Have you considered using LINQPad's built-in command-line runner to execute your scripts without a UI?
    http://www.linqpad.net/lprun.aspx
  • Intriguing idea, I may just take you up on it for longer running batch jobs.... Have you thought about this for higher volume stuff? Most of my scripts run in the context of a web request. The Web Application opens a socket to my home grown server whose purpose is to load/compile and run scripts ( if script hasn't changed since last request, then, assembly is reused).

    The reason I need to do this in a separate process is that the user is able to change the underlying data model on-the-fly which forces me to regenerate the DataContext and re-validate the syntax.

    My scripts have to change just a little from how I prototype them inside linqpad to be deployed to my "script server". For example, I have extension methods implemented for Dump() that writes to my logging system. But, when running the script inside linqpad, want to see it as linqpad dumps...

    In short, to really make full use of LINQPAD in production, I'd need it to launch as a service and process requests as a socket server. It's really not that hard to do with all the classes provided in the .Net framework. Weekend project?
  • You can certainly call lprun from a Windows Service. Or if you wanted to run it in the same process, you could reference LINQPad.exe and call Util.Run.
  • I tried to add LINQPad.exe as a reference. It compiles but throws an error at runtime. System.BadImageFormatException.... "Could not load file or assembly 'LINQPad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21353812cd2a2db5' or one of its dependencies. An attempt was made to load a program with an incorrect format."}

    Any help is appreciated. This is running from VS2010, I've made sure to set framework to 4.0.

  • You'll need to download the X64 (Any-CPU) version of LINQPad www.linqpad.net
  • Just noticed that when I use the IQ Driver, there is huge memory leak. In the connections panel, the schema is never able to load, this could be because I don't have schema read permissions. But, when I enter a sql query, it runs. All the while the memory goes up over 1 gigabyte without doing anything.

    I have to delete the IQ Driver connections for this not to happen.


    IS there a way I can do a custom datacontext using the IQ driver?
  • This seems to be behaving better with Oracle 64bit client, using ID Driver OCI type instead of direct.
Sign In or Register to comment.