Skip to main content

Posts

Showing posts with the label mono

SSLStream support added to Npgsql!

Yesterday I merged a pull request which adds support to .Net SSLStream in Npgsql. When Npgsql development started, in 2002, there was no SSL support in .net 1.0 and 1.1. It was added later in .net 2.0 but the support to SSLStream was never added to Npgsql. This all changed a few weeks ago when  Dave G created a patch which adds support to .Net SSLStream in Npgsql. He also said that one of the motivations was the fact that the current SSL support was returning error when using client certificate authentication. (I'll post a tutorial about how to use client certificates later) There is a very old feature request  (like since 2005!) to somehow create a single Npgsql.dll which incorporates Mono.Security.dll assembly. This would easy the deployment of Npgsql and version control. This feature request generated a discussion about the removal of Mono.Security dependency and possible impact in current user code.  In order to get the lowest impact by this change...

Did I say already that I'm loving MonoDevelop?

After seeing Miguel's post about the Navigation features of Monodevelop , I updated my Monodevelop version to 2.4 and I couldn't agree more with Miguel's opinion: Navigate To is the best feature of Monodevelop. It is awesome!! You remember the type you want to work with, press Command-. (I'm using OS X), type part of its name (Monodvelop guys did an wonderful job about how little you have to type to find it) and voilà, your type is open and ready to edit! See more features of Monodevelop here .

Function call performance optimizations

On my last post about that subject , I wrote about some optimizations I did to get better performance when calling functions with Npgsql. While that optimizations were very nice, they had a drawback: you had to reuse your NpgsqlCommand object. You had to reuse it because the optimizations were based on cached data and if you created a new NpgsqlCommand object the data would need to be cached again. In the general case, where you would create many NpgsqlCommand objects and call functions with them, you would not benefit from those optimizations. In order to fix that, Noah Misch created a patch which remove 2 of the 3 internal calls which were giving performance problems. The only case left is for functions which have return type of 'record'. We are working to get this case also covered. I'm going to show here how much performance improvement you get with this patch with a simple call to a function which returns an integer. This function is on Npgsql unit test suite, but I ...

Using SSL Client Certificates with Npgsql

Hi all! Recently, Jarrod Kinsley asked on our Forums how to establish an SSL connection . As Laurenz Albe pointed out, normally you just need to change your connection string to put "SSL=True;Sslmode=Require;" in your connection string and "ssl=on" in postgresql.conf and you are ready to go. The problem was that this works in the general case where you don't have to deal with client certificates and other stuff. Npgsql has a lot of callbacks to help you to validate and talk to the server. The last callback added to the chain by Frank Bollack was to provide a way to pass client certificates to server. Later on the thread, Jennifer Marienfeld was also trying to connect and was stuck in the client certificate part. Jennifer eventually got success to establish connection to the server and I decided to create this post to show the code so others can benefit from this. Here is Jennifer's code so you all can use as a template: using System; using System.IO; us...

SSL Renegotiation patch

Hi all! Albe Laurenz called my attention to a new patch applied to Postgresql servers which allows the administrator to set a value telling server when it will start SSL renegotiations. This parameter also allows you to disable the renegotiation.[1] Today, I committed a patch which tries to disable SSL Renegotiation on supported postgresql servers, which means, servers which had this patch applied. According to Albe those server versions are: 9.0, 8.4.3, 8.3.10, 8.2.16, 8.1.20, 8.0.24, 7.4.28. This patch simple calls: SET ssl_renegotiation_limit=0 as suggested by Albe. One positive side effect of this modification is that it serves as an workaround to SSL renegotiation problem with Npgsql. Today, Npgsql has problems with this, as can be seen on this bug report[2]. Although this patch isn't a solution, at least it makes Npgsql works on long SSL sessions. If you want to try it out now, please grab latest code from cvs and let us know if you got any problems on our forums: http://foru...

Better data type handling mechanism landed on cvs

Hi all! Yesterday, 2009-12-12, Josh Cooley committed a better datatype handling mechanism to Npgsql. This will allow Npgsql to be more consistent when handling types because it is now much better defined when to return specific (or provider specific) datatypes and when to return CLR datatypes. What does all this mean? Well, Npgsql now implements the methods DbDataReader.GetProviderSpecificValue() , DbDataReader.GetproviderSpecificValues() and GetProviderSpecificDataType() . With those methods implemented, users will have a defined way of getting the specific types provided by Npgsql. The other methods will now always return the CLR types. This modification will also enable Npgsql to work better with the ado.net library. For example, we have reports that NpgsqlInet data wasn't being rendered in a DataGrid . By inspecting the test case, the dataset was correctly filled, but Datagrid seemed to not like NpgsqlInet and didn't render its value. With this type handling modification...

Npgsql 2.0.7 released!

Hi all, Npgsql 2.0.7 is out. This is a minor bug fix release. The most notorious bug fix is one made by Josh Cooley about possible freezes and strange exceptions when canceling a query. So, if you were having any problem like this, please give it a try. Download it from: downloads.npgsql.org This is the release notes of this release: Bugs fixed: [#1010527] Fix query timeout connection corruption. [#1010700] Capture parameter names with NpgsqlCommandBuilder.DeriveParameters. Thanks Brian Schloz (bschloz @nospam@ hotmail.com) for patch. Also added nunit testcase. [#1010668] Npgsql ConnectionStringBuilder provides no connectionstring properties. Now Npgsql correctly reports default connectionstring properties. Thanks Alaric Dailey for heads up and patch! Fixed bug when trying to retrieve a date value with -infinity value. See more here: http://pgfoundry.org/forum/message.php?msg_id=1005249 Thanks Andrus Moor for bug report and test case and Laurenz Albe for repo...

Npgsql Tips: Using " in (...)" queries with parameters list and "any" operator

Hi, all! We have received some users questions about how to send a list of values to be used in queries using the "in" operator. Something like: select foo, bar from table where foo in (blah1, blah2, blah3); Npgsql supports array-like parameter values and the first idea to have this working would try to use it directly: NpgsqlCommand command = new NpgsqlCommand("select * from tablee where field_serial in (:parameterlist)", conn); ArrayList l = new ArrayList(); l.Add(5); l.Add(6); command.Parameters.Add(new NpgsqlParameter("parameterlist", NpgsqlDbType.Array | NpgsqlDbType.Integer)); command.Parameters[0].Value = l.ToArray(); NpgsqlDataReader dr = command.ExecuteReader(); but unfortunately this won't work as expected. Npgsql will send a query like this: select * from tablee where field_serial in ((array[5,6])::int4[]) And Postgresql will complain with the followin...

Npgsql 2.0.5 released!

Hi, all! Npgsql Development Team released Npgsql 2.0.5. This is a bug fix release. And we fixed some important bugs. The first one is about the famous NotSupportedException seek operation. Npgsql now handles this by flushing the stream before writing to it. It is not the complete solution but it is an step in the right direction. Another bug which is open for quite some time is the return value of DataAdapter.Update. It wasn't working very well for multiple statements. Now it is working ok. Josh Cooley added a lot of fixes for Entity Framework and Transactions support. Please, check our release notes to see all the changes on this release. You can download this release on our usual location . Thanks everybody who helped us with comments, feedback and patches.

Did you like Npgsql? Send us a postcard!

Hi all! Some time ago, a friend of mine, Horita, told me about a project whose owner asked people who liked his software to send him a postcard. I liked the idea and yesterday, while cooking the 2.0.2 release with Josh Cooley, I told him about this idea and he also liked it. So, if you like Npgsql you can send us a postcard. Here are the addresses: Josh Cooley 102 Boston Harbour Way Madison, AL 35758 USA Francisco Figueiredo Jr. QMSW 05 Lote 02 Bloco C Apto 116 Sudoeste - Brasilia - DF - Brazil Zip Code: 70680-500 Thank you very much!

Npgsql 2.0.2 released!

Hi all! Npgsql Development Team is proud to announce we just released Npgsql 2.0.2! This release brings the usual bug fixes and minor improvements from previous release. Here are the release notes: Fixes: Fix the fix for datetime.MinValue and MaxValue. Only MinValue was fixed. Now both Min and Max are fixed. Thanks Andrus Moor for heads up.(fxjr) Fixed problem with parameter sizes and prepared statements.(fxjr) [#1010488] NgsqlParameter of type containing DBNull values throws NullReferenceException [#1010521] NpgsqlInterval should be quoted. Datetime with negative values (thanks to Mathieu Fenniak ) and singular values such as "1 day" [#1010495] Bad performance calling a (empty) function very often. New additions: Added documentation about how to use Npgsql with Provider Factory. Thanks Alaric for heads up. Ensure refcursors work with System.Transactions. (Josh) On this release, Josh Cooley fixed some bugs on Entity Framework support and System.Transactions. For mo...

NpgsqlCommand optimizations and usage tip

Hi, all! Some days ago, I fixed a slow performance problem with Npgsql when calling functions . The problem was that Npgsql was doing a lot of expensive checks (in fact, 3) to verify parameter information and return type. The solution was to cache those checks so that new calls to the same function don't need to pass through the same checks again. In order to not have problems with outdated caches and etc and after talking to Josh on gmail, I decided to make the cache local and it would be invalidated as soon as the command text is changed. This semantics lead me to write this blog to share the idea that you can get a big performance improvement if you "cache" your NpgsqlCommands which will be used with function calls. This way, instead of creating and releasing the command object after its usage, you can create all your NpgsqlCommand objects associated to function calls and reuse them as needed. This way you pay for the costly checks only once. I hope this tip can help ...

Npgsql2 Final Released!!

Hi, all! The Npgsql Development Team is proud to announce the Npgsql2 RTM! Npgsql is a .Net Data provider written 100% in C# which allows .net programs to talk to postgresql backends. Npgsql is licensed under BSD. More info can be obtained from http://www.npgsql.org After almost two years of development since Npgsql 1.0, Npgsql 2 brings new features and support for newer versions of .Net. Although externally Npgsql2 doesn't seem very different of Npgsql1 regarding features, internally Npgsql2 had a lot of improvements which represents a much more stable product, more bugs fixed and many implemented methods. It is strongly advised that current users update from Npgsql1 to Npgsql2. Main features are: Support for .Net 2.0 and 3.5 Josh Cooley did a great job and added support for EntityFramework. Npgsql2 now doesn't read all table contents before returning control to user code. This makes Npgsql much more memory efficient when dealing with large tables. Thanks Jon Hanna for this. C...

Npgsql2 RC2 Released!!

Hi all! It's a great pleasure to say that Npgsql2 RC2 is released. From release notes: This version contains some fixes and updates for latest entity framework release. We are already in feature freeze and not so many things were added this time. Highlights include: Npgsql2 rc2 now supports .NET 3.5 sp1 with Entity Framework support. We support model generation by the command line edmgen.exe tool. This requires the Npgsql be registered in the provider section of machine.config. A lot of fixes were done on connection pool handling. Also, when running under Mono, Npgsql wasn't using connection pool. Now it is. We added some code to better handle threadabort when executing queries with Npgsql. It isn't perfect but is much better than with previous versions. Grab it from http://downloads.npgsql.org Thank you everybody who helped with bug reports, comments and patches!

Npgsql2 RC1 Released!

Hi, all! It's a great pleasure to say Npgsql Development Team made a new release of Npgsql2. We are closer to the final release! On the highlights, thanks to Josh Cooley, we have support for newer version of EntityFramework 3.5sp1beta. Another highlight is that we fixed the cast problem some people had when using Npgsql2 beta4. Now, Npgsql will only use casts if the user explicitly specify a DbType or NpgsqlDbType value. Also, thanks Andreas Schönebeck, who provided us with testcases and feedback, we have a much better threadabortexception handling. Those exceptions were making Npgsql be instable and sometimes unusable. Please, if you had any problem, give RC1 a try and help us to improve Npgsql for final release. Other changes can be seen in our changelog . Donwload Npgsql2RC1 from our usual place Thank you to all who helped us with this release with feedback, bug fixes, bug reports and comments.

And now going to Toronto to see Niagara Falls

Hi all!! Tomorrow I'm leaving Ottawa heading to Toronto to see Niagara Falls. I'll be taking a bus to go there and I hope to be able to get some guided tour to Falls. If not, I will go by myself anyway :) I will be at Backpackers on Dundas hostel and I plan to stay there until next Tuesday when I will go back to Ottawa for PG Con. So, if you are in Toronto and would like to talk about Npgsql, Postgresql or Mono, or just want to talk, please, drop me a mail. P.S.: Kangaroo (Mono irc, sorry if this isn't exactly your nickname) please, drop me a mail so we can have some beers in Toronto! See you.

Array support commited in Npgsql2 cvs

Hi, all! As previously stated , array support was in the works and now it is commited to cvs! So, from now on you can start persisting array data to postgresql. Thanks very much to Jon Hanna for getting this work done. Now, you can persist arrays and, as Jon said in previous post's comments: "Anything that implements IEnumerable<T> where T is a type already supported by npgsql will be treated the same as T[], anything that implements IEnumerable<U&gt where U implements IEnumerable<T&gt will be treated the same as T[,] (but cause an error if it's a "jagged" array, as postgres doesn't support them) and so on. In order to use it, just use an array or IEnumerable<T&gt as parameter value." So, let the game begin! Also, thanks to Michael Parshin for his help fixing bugs on array type support.

Npgsql has a new homepage layout

Hi, all! After some research on open source site web designs: www.oswd.org , www.openwebdesign.org and www.opendesigns.org , I finally choose this one, from styleshout. Npgsql homepage now looks nicer than previous one . Please, send your feedback and suggestions for this new site. Thanks in advance.

Npgsql License change is almost done!

UPDATE2 at 2007-08-10: Chris just sent me his permission. So, now, there are only 2 permissions pending. License change is very near!! UPDATE: Daniel Morgan and Magnus Hagander sent me their permission. We are now waiting for others to send theirs. Hi all!! I have been revising some more files to make Npgsql license change and we are very close now. There are only 6 files pending waiting for permissions: NpgsqlCommandBuilder.cs Waiting license change permission from gridnine systems. http://pgfoundry.org/tracker/index.php?func=detail&aid=1000447&group_id=1000140&atid=592 NpgsqlDataReader.cs Waiting Daniel Morgan license chage permission request. NpgsqlParameter.cs Waiting license change permission from gridnine systems. http://pgfoundry.org/tracker/index.php?func=detail&aid=1000447&group_id=1000140&atid=592 NpgsqlRowDescription.cs Waiting license change permission from Magnus Hagander. PGUtil.cs Waiting license change permission from Chris Wenneman NpgsqlTypesHe...