[Mono-list] Problem with Oracle and Mono Charset...
Daniel Morgan
danielmorgan@verizon.net
Tue, 01 Mar 2005 22:32:25 -0500
IntPtr is fine since the OCI types are opaque. Try looking at
OciCalls.cs and OciGlue.cs for examples.
CreateConnection shows how a connection to Oracle currently happens.
ub4 is an unisigned four-byte integer which might work with uint.
sb4 is a signed four-byte integer which might work with int.
(text *) can be passed via a byte array.
Many times when passing a string to Oracle, you might need to convert it
via the following code:
string stringToPassToOracle = "Hello";
int rsize = 0;
// Get size of buffer
OciCalls.OCIUnicodeToCharSet (statement.Parent, null, sDate, out rsize);
// Fill buffer
byte[] bytes = new byte[rsize];
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, sDate, out rsize);
sword OCIConnectionPoolCreate ( OCIEnv *envhp,
OCIError *errhp,
OCICPool *poolhp,
OraText **poolName,
sb4 *poolNameLen,
CONST OraText *dblink,
sb4 dblinkLen,
ub4 connMin,
ub4 connMax,
ub4 connIncr,
CONST OraText *poolUsername,
sb4 poolUserLen,
CONST OraText *poolPassword,
sb4 poolPassLen,
ub4 mode );
Hubert FONGARNAND wrote:
>I'm interested in implement connection pooling on oracle...
>I just need some info about creating dllimport functions....
>
>The C function is :
> OCIOCIConnectionPoolCreate((OCIEnv *)envhp,
> (OCIError *)errhp, (OCICPool *)poolhp,
> &poolName, &poolNameLen,
> (text *)database,strlen(database),
> (ub4) conMin, (ub4) conMax, (ub4) conIncr,
> (text *)pooluser,strlen(pooluser),
> (text *)poolpasswd,strlen(poolpasswd),
> OCI_DEFAULT));
>
>i've began :
>
> //fongarnand
> [DllImport ("oci")]
> internal static extern int OCIConnectionPoolCreate(IntPtr envhp,
> IntPtr errhp, IntPtr poolhp, ...
>
>But i don't know wich datatype to use...
>
>Le Lundi 28 Février 2005 13:55, Daniel Morgan a écrit :
>
>
>>Sure, you can implement. We accept patches.
>>
>>You could look at System.Data.SqlClient on how it does connection pooling.
>>
>>Another way is to use some OCI functions for connection pooling. So,
>>you might have to create DllImport functions for these OCI functions.
>>
>>Oracle 9i Call Interface Programmer's Guide
>>http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96584/oci15re
>>2.htm#556061
>>
>>OCIConnectionPoolCreate
>>OCIConnectionPoolDestroy
>>
>>Hubert FONGARNAND wrote:
>>
>>
>>>Thank you for your fix... It works now without any problems...
>>>Just a question, do you plan to implement connection pooling on oracle
>>>client classes. I've seen that dealing with oracle database works well
>>>with mono (now) but it's much more slower than MS.NET when you open and
>>>close many connections... Is there a way to speed up this process.
>>>I'm ready to help you implementing this, if you need...
>>>
>>>Le Samedi 26 Février 2005 05:38, vous avez écrit :
>>>
>>>
>>>>I recently committed a fix to svn trunk HEAD for strings in
>>>>OracleParameter to use OCIUnicodeToCharSet for Oracle data types dates,
>>>>CLOBs, VARCHAR2/CHAR, etc...
>>>>
>>>>Can you try your tests again to see if they work now? I do not know
>>>>French to test the changes. :-)
>>>>
>>>>Hubert FONGARNAND wrote:
>>>>
>>>>
>>>>>Thanks to Daniel Morgan
>>>>>DataTime and OracleDateTime works now perfectly. There's still a problem
>>>>>with charset.When my NLS_LANG variable isn't set (on my mono client),
>>>>>french "éè" are seen as "??" in the database (MS.NET client see "??").
>>>>>The only way to display the "éè" correctly is to set my NLS_LANG to :
>>>>>NLS_LANG="FRENCH_FRANCE.UTF8" (but normally, the client should adapt
>>>>>itself to the server settings)
>>>>>but there's still a problem with string length. eg: when I do an
>>>>>"INSERT" with a string with some "éè" the string is "cut" by oracle, so
>>>>>I can not see the entire string in the database...
>>>>>
>>>>>
>>_______________________________________________
>>Mono-list maillist - Mono-list@lists.ximian.com
>>http://lists.ximian.com/mailman/listinfo/mono-list
>>
>>
>
>
>