Forum: help
Monitor Forum | | NpgsqlTypeConverter.ToBoolean cast exception [ reply ] By: Kelly Anderson on 2007-03-27 18:08 | [forum:1002274] |
|
It seems to me that NpgsqlTypeConverter.ToBoolean should convert native int types to boolean. Until I added the check for int to the function .NET would throw a cast exception. Potentially other native types should be checked also. <code> /// <summary> /// Convert to a postgresql boolean. /// </summary> internal static String ToBoolean(NpgsqlNativeTypeInfo TypeInfo, Object NativeData) { if (NativeData is int) { return ((int)NativeData == 0) ? "FALSE" : "TRUE"; } return ((bool)NativeData) ? "TRUE" : "FALSE"; } </code> |
|
RE: NpgsqlTypeConverter.ToBoolean cast except [ reply ]
By: Josh Cooley on 2007-03-28 03:28[forum:1002277]
Kelly,
How are you calling Npgsql when you get the cast exception?
JoshRE: NpgsqlTypeConverter.ToBoolean cast except [ reply ]
By: Kelly Anderson on 2007-03-28 03:43[forum:1002278]
I'm using a wrapper function to force a bool parm to be passed to the database. I found this necessary since the code that calls my DB layer passes objects and in the event of a NULL value Npgsql assumes that it is a text value, which of course passes the wrong DB types to the DB and it doesn't find the appropriate stored proc.
private static NpgsqlParameter BoolParm(string parmName, object value)
{
NpgsqlParameter parm = new NpgsqlParameter(parmName, NpgsqlDbType.Boolean);
parm.Value = value;
return parm;
}
using(NpgsqlCommand cmd = new NpgsqlCommand("storedproc_name"))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(BoolParm("@Replace",Replace));
ExecuteNonQuery(cmd);
}
| Postgres arrays in npgsql [ reply ] By: Chris Coleman on 2007-03-21 10:44 | [forum:1002269] |
|
Hi, I have the following PL function: FunctionDoSomething(text[]) The parameter of this takes an array of key, value pairs, which are other arrays of size 2. eg: { {'key1', 'value1'}, '{key2', 'value2'} } Now, one of the values can also be an array of integers, eg {1,2,3} which I write as: { {'key1', 'value1'}, '{key2', '{val_2a, val_2b}'} } This is syntacticaly invalid, so I re write it using the array constructor syntax as: ARRAY[ ARRAY['key1', 'value1'], ARRAY['key2', '{val_2a, val_2b}'] ] How would I parse this to a stored procedure using the npgsql wrapper? I could pass it as a complete sql string, but the npgsql wrapper provides no escapeing functionality other than through its named parameter method. Any ideas would be glady recieved. Many thanks Chris |
|
RE: Postgres arrays in npgsql [ reply ]
By: Chris Coleman on 2007-03-21 12:12[forum:1002270]
Ah - ok I've just seen this while reading some older messages in the Forums: http://pgfoundry.org/forum/forum.php?thread_id=852&forum_id=519
So what is the best method of using arrays, not within prepared statements? Is there any way I can escape my text without using prepared statements?
| ERROR: Query was cancelled [ reply ] By: Brandon Arnold on 2007-03-20 15:22 | [forum:1002264] |
|
Hi, This is a message that I only recently started receiving upon database queries to an external pgsql server. The Pgsql server version is 7.3.4 and Npgsql version (the .NET 2 build) is version 1.0.0.0. The connection seems to open fine, only when I pass a query string and execute it (ExecuteScalar, ExecuteReader, ...) I get the subject line error. If I fire up a cygwin shell and connect manually with the psql command, I can perform queries just fine. Has anyone come across this before? Thanks, Brandon |
|
RE: ERROR: Query was cancelled [ reply ]
By: Francisco Figueiredo jr. on 2007-03-20 15:30[forum:1002265]
Hi Brandon!
Does your query take a lot of time?
Npgsql has support for command execution timeout which may be being hit by your queries.
You can change the default value of 20 seconds by using the CommandTimeout in you connection string.
I hope it helps.
RE: ERROR: Query was cancelled [ reply ]
By: Brandon Arnold on 2007-03-20 15:46[forum:1002266]
Thanks Francisco, that's exactly what it was. :) RE: ERROR: Query was cancelled [ reply ]
By: Francisco Figueiredo jr. on 2007-03-20 16:49[forum:1002268]
Great!
I'm glad I could help you. :)
| Npgsql source build failure, missing .ctor [ reply ] By: Kelly Anderson on 2007-03-12 09:53 | [forum:1002245] |
|
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Npgsql.build Target framework: Mono 2.0 Profile Target(s) specified: build Built-in property 'nant.project.basedir' is deprecated. Use the project::get-base-directory() function instead. Built-in property 'nant.project.basedir' is deprecated. Use the project::get-base-directory() function instead. init: [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms'. [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms'. [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms/Design'. [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/res/ms/NpgsqlTypes'. [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/mono'. [mkdir] Creating directory '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/nunit2tests'. resources: [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.resx' [resgen] Writing resource file... Done. [resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 10 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 11 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommandBuilder.resx' [resgen] Writing resource file... Done. [resgen] Read in 9 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectedState.resx' [resgen] Writing resource file... Done. [resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 13 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.resx' [resgen] Writing resource file... Done. [resgen] Read in 6 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectionString.resx' [resgen] Writing resource file... Done. [resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 12 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlEventLog.resx' [resgen] Writing resource file... Done. [resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlException.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameter.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterCollection.resx' [resgen] Writing resource file... Done. [resgen] Read in 10 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlReadyState.resx' [resgen] Writing resource file... Done. [resgen] Read in 14 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlTransaction.resx' [resgen] Writing resource file... Done. [resgen] Read in 2 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/PGUtil.resx' [resgen] Writing resource file... Done. [resgen] Read in 37 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.de.resx' [resgen] Writing resource file... Done. [resgen] Read in 37 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.es.resx' [resgen] Writing resource file... Done. [resgen] Read in 23 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.fi.resx' [resgen] Writing resource file... Done. [resgen] Read in 31 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.ja.resx' [resgen] Writing resource file... Done. [resgen] Read in 620 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/Design/ConnectionStringEditorForm.resx' [resgen] Writing resource file... Done. [resgen] Read in 1 resources from '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.resx' [resgen] Writing resource file... Done. build: [csc] Compiling 58 files to '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll'. [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(438,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(151,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.DeleteCommand' hides inherited member `System.Data.Common.DbDataAdapter.DeleteCommand'. Use the new keyword if hiding was intended [csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(178,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.SelectCommand' hides inherited member `System.Data.Common.DbDataAdapter.SelectCommand'. Use the new keyword if hiding was intended [csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(206,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.UpdateCommand' hides inherited member `System.Data.Common.DbDataAdapter.UpdateCommand'. Use the new keyword if hiding was intended [csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(233,30): warning CS0108: `Npgsql.NpgsqlDataAdapter.InsertCommand' hides inherited member `System.Data.Common.DbDataAdapter.InsertCommand'. Use the new keyword if hiding was intended [csc] /usr/lib/mono/gac/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll (Location of the symbol related to previous warning) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(353,32): warning CS0419: Ambiguous reference in cref attribute `System.Data.Common.DbDataAdapter.Update'. Assuming `System.Data.Common.DbDataAdapter.Update(System.Data.DataTable, System.Data.Common.DataTableMapping)' but other overloads including `System.Data.Common.DbDataAdapter.Update(System.Data.DataRow[], System.Data.Common.DataTableMapping)' have also matched [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.cs(823,26): warning CS1570: XML comment on `M:Npgsql.NpgsqlConnection.GetSchema' has non-well-formed XML (unexpected end of file. Current depth is 2 Line 4, position 1.) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(236,21): warning CS1572: XML comment on `Npgsql.NpgsqlConnectorPool.ReleaseConnector(Npgsql.NpgsqlConnection, Npgsql.NpgsqlConnector)' has a param tag for `ForceClose', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(407,21): warning CS1570: XML comment on `M:Npgsql.NpgsqlConnectorPool.FixPoolCountBecauseOfConnectionDisposeFalse(Npgsql.NpgsqlConnection)' has non-well-formed XML (Expected >, but found EOF [-1] Line 7, position 1.) [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `OID', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `Type', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(587,16): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeInfo.NpgsqlNativeTypeInfo(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(769,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlBackendTypeMapping.AddType(int, string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, System.Type, NpgsqlTypes.ConvertBackendToNativeHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `OID', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertBackendToNative', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(873,21): warning CS1572: XML comment on `NpgsqlTypes.NpgsqlNativeTypeMapping.AddType(string, NpgsqlTypes.NpgsqlDbType, System.Data.DbType, bool, NpgsqlTypes.ConvertNativeToBackendHandler)' has a param tag for `ConvertNativeToBackend', but there is no parameter by that name [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(39,26): warning CS1574: XML comment on `Npgsql.NpgsqlRowUpdatedEventHandler' has cref attribute `Npgsql.NpgsqlRowUpdatedEventArgs' that could not be resolved [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataAdapter.cs(46,26): warning CS1574: XML comment on `Npgsql.NpgsqlRowUpdatingEventHandler' has cref attribute `Npgsql.NpgsqlRowUpdatingEventArgs' that could not be resolved [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/MD5CryptoServiceProvider.cs(33,46): warning CS3019: CLS compliance checking will not be performed on `Npgsql.MD5CryptoServiceProvider._H' because it is not visible from outside this assembly [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/MD5CryptoServiceProvider.cs(34,44): warning CS3019: CLS compliance checking will not be performed on `Npgsql.MD5CryptoServiceProvider.count' because it is not visible from outside this assembly [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(417,28): warning CS0219: The variable `cursorName' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(617,29): warning CS0219: The variable `typeoid' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlState.cs(613,25): warning CS0219: The variable `lenght' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.cs(73,28): warning CS0618: `System.Net.Dns.Resolve(string)' is obsolete: `Use GetHostEntry instead' [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlClosedState.cs(107,34): warning CS0168: The variable `ex' is declared but never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(767,28): warning CS0219: The variable `portalName' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnection.cs(493,20): warning CS0219: The variable `oldDatabaseName' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataReader.cs(322,36): warning CS0219: The variable `TI' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParameterStatus.cs(55,19): warning CS0219: The variable `messageLength' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(103,31): warning CS0168: The variable `e' is declared but never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(160,32): warning CS0219: The variable `param' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(158,32): warning CS0219: The variable `msg' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(157,31): warning CS0219: The variable `pid' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(156,31): warning CS0219: The variable `msglen' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(174,31): warning CS0219: The variable `l_nlen' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(183,31): warning CS0219: The variable `l_msgLen' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(225,30): warning CS0219: The variable `l_tStatus' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(281,32): warning CS0219: The variable `msg' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(280,31): warning CS0219: The variable `pid' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/FastPath.cs(330,35): warning CS0219: The variable `l_endChar' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(129,13): warning CS0162: Unreachable code detected [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlBind.cs(44,40): warning CS0414: The private field `Npgsql.NpgsqlBind.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCancelRequest.cs(38,40): warning CS0414: The private field `Npgsql.NpgsqlCancelRequest.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommand.cs(70,30): warning CS0414: The private field `Npgsql.NpgsqlCommand.invalidTransactionDetected' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlCommandBuilder.cs(45,40): warning CS0414: The private field `Npgsql.NpgsqlCommandBuilder.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectionString.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlConnectionString.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(384,33): warning CS0169: The private method `Npgsql.NpgsqlConnectorPool.GetSharedConnector(Npgsql.NpgsqlConnection)' is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlConnectorPool.cs(498,22): warning CS0169: The private method `Npgsql.NpgsqlConnectorPool.UngetSharedConnector(Npgsql.NpgsqlConnection, Npgsql.NpgsqlConnector)' is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDataReader.cs(79,25): warning CS0169: The private method `Npgsql.NpgsqlDataReader.HaveRow()' is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlDescribe.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlDescribe.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlException.cs(44,40): warning CS0414: The private field `Npgsql.NpgsqlException.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlExecute.cs(40,40): warning CS0414: The private field `Npgsql.NpgsqlExecute.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlFlush.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlFlush.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlParse.cs(45,40): warning CS0414: The private field `Npgsql.NpgsqlParse.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/NpgsqlSync.cs(41,40): warning CS0414: The private field `Npgsql.NpgsqlSync.CLASSNAME' is assigned but its value is never used [csc] /home/kelly/src/packages/npgsql/cvs/Npgsql/src/NpgsqlTypes/NpgsqlTypesHelper.cs(44,40): warning CS0414: The private field `NpgsqlTypes.NpgsqlTypesHelper.resman' is assigned but its value is never used [csc] Compilation succeeded - 56 warning(s) [al] Compiling 7 files to '/home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/de/Npgsql.resources.dll'. [al] ** (/usr/lib/mono/1.0/al.exe:28176): WARNING **: Missing method .ctor in assembly /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll, type System.Runtime.CompilerServices.RuntimeCompatibilityAttribute [al] ** ERROR **: Can't find custom attr constructor image: /home/kelly/src/packages/npgsql/cvs/Npgsql/src/Npgsql/build/ms/Npgsql.dll mtoken: 0x0a0001d5 [al] aborting... [al] Stacktrace: [al] at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00004> [al] at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0xffffffff> [al] at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider,System.Type) <0x00025> [al] at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x0007e> [al] at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider,bool) <0x00084> [al] at System.Reflection.Assembly.GetCustomAttributes (bool) <0x0000f> [al] at Mono.AssemblyLinker.AssemblyLinker.DoIt () <0x001e9> [al] at Mono.AssemblyLinker.AssemblyLinker.DynMain (string[]) <0x00018> [al] at Mono.AssemblyLinker.AssemblyLinker.Main (string[]) <0x00025> [al] at (wrapper runtime-invoke) System.Object.runtime_invoke_int_string[] (object,intptr,intptr,intptr) <0xffffffff> [al] Native stacktrace: [al] /usr/bin/mono [0x815778a] [al] [0xffffe440] [al] /lib/tls/libc.so.6(abort+0xe9) [0xb7d160d9] [al] /usr/lib/libglib-2.0.so.0 [0xb7e818d2] [al] /usr/lib/libglib-2.0.so.0(g_log+0x26) [0xb7e81906] [al] /usr/bin/mono(mono_custom_attrs_from_index+0x1d0) [0x80d8c20] [al] /usr/bin/mono(mono_custom_attrs_from_assembly+0x44) [0x80d8d54] [al] /usr/bin/mono(mono_reflection_get_custom_attrs_info+0x141) [0x80d91f1] [al] /usr/bin/mono(mono_reflection_get_custom_attrs_by_type+0x14) [0x80e35e4] [al] [0xb7422b3f] [al] [0xb7422a56] [al] [0xb74223b7] [al] [0xb7422245] [al] [0xb74221a8] [al] [0xb7aaf602] [al] [0xb7aa3069] [al] [0xb7aa287e] [al] [0xb7aa27d5] [al] /usr/bin/mono(mono_runtime_exec_main+0x13c) [0x80cce5c] [al] /usr/bin/mono(mono_runtime_run_main+0x21f) [0x80cd0ef] [al] /usr/bin/mono(mono_main+0xfeb) [0x805915b] [al] /usr/bin/mono [0x8057c8e] [al] /lib/tls/libc.so.6(__libc_start_main+0xd4) [0xb7d00e14] [al] /usr/bin/mono [0x8057bb1] [al] Debug info from gdb: [al] (no debugging symbols found) [al] Using host libthread_db library "/lib/tls/libthread_db.so.1". [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] [Thread debugging using libthread_db enabled] [al] [New Thread -1211193664 (LWP 28176)] [al] [New Thread -1219290192 (LWP 28180)] [al] [New Thread -1209107536 (LWP 28178)] [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] (no debugging symbols found) [al] 0xb7d77fe1 in fork () from /lib/tls/libc.so.6 [al] 3 Thread -1209107536 (LWP 28178) 0xb7e4899c in __nanosleep_nocancel () [al] from /lib/tls/libpthread.so.0 [al] 2 Thread -1219290192 (LWP 28180) 0xb7e45b11 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0 [al] 1 Thread -1211193664 (LWP 28176) 0xb7d77fe1 in fork () [al] from /lib/tls/libc.so.6 [al] Thread 3 (Thread -1209107536 (LWP 28178)): [al] #0 0xb7e4899c in __nanosleep_nocancel () from /lib/tls/libpthread.so.0 [al] #1 0x080f052e in mono_thread_interruption_request_flag () [al] #2 0xb7e4320e in start_thread () from /lib/tls/libpthread.so.0 [al] #3 0xb7db50de in clone () from /lib/tls/libc.so.6 [al] Thread 2 (Thread -1219290192 (LWP 28180)): [al] #0 0xb7e45b11 in pthread_cond_wait@@GLIBC_2.3.2 () [al] from /lib/tls/libpthread.so.0 [al] #1 0x080f543f in mono_thread_interruption_request_flag () [al] #2 0x080f55af in mono_thread_interruption_request_flag () [al] #3 0x080f571a in mono_thread_interruption_request_flag () [al] #4 0x08104d72 in mono_pthread_key_for_tls () [al] #5 0x080a251c in mono_domain_finalize () [al] #6 0x080ef1fe in mono_thread_get_pending_exception () [al] #7 0x08104105 in mono_pthread_key_for_tls () [al] #8 0x08115f04 in GC_push_all_stack () [al] #9 0x08116530 in GC_start_blocking () [al] #10 0x00000000 in ?? () [al] Thread 1 (Thread -1211193664 (LWP 28176)): [al] #0 0xb7d77fe1 in fork () from /lib/tls/libc.so.6 [al] #1 0xb7e4a144 in fork () from /lib/tls/libpthread.so.0 [al] #2 0xb7ea2018 in g_spawn_error_quark () from /usr/lib/libglib-2.0.so.0 [al] #3 0xb7ea2a3f in g_spawn_sync () from /usr/lib/libglib-2.0.so.0 [al] #4 0xb7ea2ef7 in g_spawn_command_line_sync () from /usr/lib/libglib-2.0.so.0 [al] #5 0x08157823 in mono_debugger_run_finally () [al] #6 <signal handler called> [al] #7 0xb7d14847 in raise () from /lib/tls/libc.so.6 [al] #8 0xb7d160d9 in abort () from /lib/tls/libc.so.6 [al] #9 0xb7e818d2 in g_logv () from /usr/lib/libglib-2.0.so.0 [al] #10 0xb7e81906 in g_log () from /usr/lib/libglib-2.0.so.0 [al] #11 0x080d8c20 in mono_custom_attrs_from_index () [al] #12 0x080d8d54 in mono_custom_attrs_from_assembly () [al] #13 0x080d91f1 in mono_reflection_get_custom_attrs_info () [al] #14 0x080e35e4 in mono_reflection_get_custom_attrs_by_type () [al] #15 0xb7422b3f in ?? () [al] #16 0x00041e40 in ?? () [al] #17 0x00000000 in ?? () [al] #0 0xb7d77fe1 in fork () from /lib/tls/libc.so.6 [al] ================================================================= [al] Got a SIGABRT while executing native code. This usually indicates [al] a fatal error in the mono runtime or one of the native libraries [al] used by your application. [al] ================================================================= BUILD FAILED - 0 non-fatal error(s), 172 warning(s) External Program Failed: /usr/lib/mono/1.0/al.exe (return code was 134) Total time: 4 seconds. |
|
RE: Npgsql source build failure, missing .cto [ reply ]
By: Francisco Figueiredo jr. on 2007-03-20 16:44[forum:1002267]
Hi Kelly!
This is strange....
I compile it ok in my dev box. Did you try with another mono version?
At least Npgsql.dll is being produced which will allow you to use unless you need the satellite assemblies.
I hope it helps.
| User 'postgres' cannot login [ reply ] By: Penelope Dramas on 2007-03-19 20:15 | [forum:1002262] |
|
Hello, We just switched from MSDE to PostgreSQL and I'm having some problems. I have created postgresql account when installing and I'm unable to login through npgsql.net driver. I keep getting password error. However, when I create another user I have no problems logging in. Is there any restriction for 'postgresql' user built-in .net driver? Thanks ... Penelope D. |
|
RE: User 'postgres' cannot login [ reply ]
By: Josh Cooley on 2007-03-20 03:31[forum:1002263]
Your postgres user may not be configured to allow a remote login. Check your pg_hba.conf file -
http://www.postgresql.org/docs/8.1/static/client-authentication.html
There may be an easier way, but I'm not familiar with all of the features from the admin tools.
| Hundreds of open connections on server.... [ reply ] By: steven floyd on 2007-03-05 00:14 | [forum:1002223] |
|
Have written the user interface using Visual Basic Express 2005. Some tables have RULES that NOTIFY each each time the rows are inserted, deleted or notified. The clients LISTEN and update the user interfaces. Worked well for a week then found that table inserts and updates were becomming slower and slower.... Tracked down that the database server had lots of connections (maybe 100 or so). Each time the table was modified the server CPU go to 100% while all the connections were notified. Found that all the connections were caused by my client programs not closing the connections when they were exiting. Had to restart the database server to get rid all the unclosed connections. Fixed my program so it now closes the connection on exit. However, if program crashes the connection can be left open. I would never had found the problem if I was not using notify. Questions: 1. Is this a bug in the NpgsqlConnection? (Should it be closing the connection automatically in it's destructor?) 2. Can the connection or the server be setup automatically close unused connections? Any input would be appreciated! Thanks Steven. |
|
RE: Hundreds of open connections on server... [ reply ]
By: Francisco Figueiredo jr. on 2007-03-05 18:28[forum:1002227]
Hi Steven!
This is very strange... You should be using just one extra connection for each one which uses sync notification=true.
As soon as NpgsqlConnection is destroyed and it still holds a reference to an open tcp connection, the framework drops it. I don't know why your tcp connection isn't being dropped.
Is there some proxy or something like that between your clients and database server? When you client crashes, all your tcp connection should be released, at least theorically, but if you have some proxy, it should be not closing the connections to your database server.
I don't know if there is a configuration in postgresql to drop idle connections. I will look for it and reply you back if I find anything.
I hope it helps.
| problem with IDataReader + npgsql [ reply ] By: Jan Dante Meulemeester on 2007-02-27 16:22 | [forum:1002206] |
|
I'm getting the following problem: Unhandled Exception: Npgsql.NpgsqlException: syntax error at or near "=" Severity: ERROR Code: 42601 at Npgsql.NpgsqlConnector.CheckErrors () [0x00000] at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications () [0x00000] at Npgsql.NpgsqlCommand.ExecuteCommand () [0x00000] at Npgsql.NpgsqlCommand.ExecuteReader (CommandBehavior cb) [0x00000] at Npgsql.NpgsqlCommand.ExecuteReader () [0x00000] at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader () [0x00000] at ERPforKMO.Klantenbeheer..ctor () [0x000d1] in /home/jandante/Projects/ERPforKMO/ERPforKMO/Klantenbeheer.cs:51 at ERPforKMO.MainClass.Main (System.String[] args) [0x00005] in /home/jandante/Projects/ERPforKMO/ERPforKMO/Main.cs:14 with the following code: public Klantenbeheer() : base(null) { Stetic.Gui.Build(this, typeof(ERPforKMO.Klantenbeheer)); string connectionString = "Server=localhost;" + "Database=ERPforKMO;" + "User ID=postgres;" + "Password=CwWnxaW7;"; IDbConnection dbcon; dbcon = new NpgsqlConnection(connectionString); dbcon.Open(); IDbCommand dbcmd = dbcon.CreateCommand(); string sql = "SELECT id, naam, rechtsvorm_id, adres, postcode_id, tel, e_mail " + "FROM administration.bedrijven"; dbcmd.CommandText = sql; IDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { txtID.Text = Convert.ToString(reader["id"]); txtName.Text = (string) reader["naam"]; txtAddress.Text = (string) reader["adres"]; string test = Convert.ToString(reader["postcode_id"]); //Postcode en gemeente ophalen IDbCommand dbcmd2 = dbcon.CreateCommand(); string sqlPostcodeGemeente = "SELECT id, postcode, stad, provincie, land " + "FROM administration.postcode" + "WHERE id = " + test; dbcmd2.CommandText = sqlPostcodeGemeente; (THE FOLLOWING LINE IS THE FAULT) IDataReader readerPostcode = dbcmd2.ExecuteReader(); while (readerPostcode.Read()) { txtPostcode.Text = Convert.ToString(readerPostcode["postcode"]); } readerPostcode.Close(); readerPostcode = null; dbcmd2.Dispose(); dbcmd2 = null; txtTel.Text = Convert.ToString(reader["tel"]); txtEmail.Text = (string) reader["e_mail"]; } //clean up reader.Close(); reader = null; dbcmd.Dispose(); dbcmd = null; dbcon.Close(); dbcon = null; } The error is marked with: (THE FOLLOWING LINE GIVES THE ERROR) I'm developping with monodevelop (0.12) and the mono 2.0 stack. It's the same code as with the first IDataReader (dbcmd)... |
|
RE: problem with IDataReader + npgsql [ reply ]
By: Josh Cooley on 2007-02-28 13:43[forum:1002211]
Is it possible for administration.bedrijven.postcode_id to be DBNull? Is administration.postcode.id a number?
If postcode_id is nullable, then the string could be coming back as empty from Convert.ToString. If id is not a number, then you have an unquoted value in your select.
RE: problem with IDataReader + npgsql [ reply ]
By: Jan Dante Meulemeester on 2007-03-02 08:16[forum:1002217]
administration.bedrijven.postcode_id is not nullable and is indeed a number. What do you meen with 'an unquoted value in you select'?
Thanks for the helpRE: problem with IDataReader + npgsql [ reply ]
By: Jan Dante Meulemeester on 2007-03-02 08:32[forum:1002218]
ow it was a fault in my sql query as you probably ment
thanks
| DataReader VS. DataSet ?? [ reply ] By: Ayna Mayna on 2007-02-28 07:45 | [forum:1002210] |
|
What is your advise in general conditions? Thank you. |
|
| How to get number of rows? [ reply ] By: Ayna Mayna on 2007-02-27 07:32 | [forum:1002202] |
|
How can I get number of rows in my query? Thank you... |
|
RE: How to get number of rows? [ reply ]
By: Maarten Claes on 2007-02-27 07:45[forum:1002203]
Are you using a datareader or dataset? RE: How to get number of rows? [ reply ]
By: Ayna Mayna on 2007-02-28 07:43[forum:1002209]
I am using data reader.
I have fix it thank you.
The Solve:
At first you should use "COUNT" command in your sql query. Then you will get the number of rows as "Convert.ToInt64(reader_[0])". Then you should continue your way.
| executeReader duda [ reply ] By: victor chavez on 2007-02-27 10:25 | [forum:1002204] |
|
es posible ejecutar un query dentro de otro sin haber cerrado el reader anterior? es decir: NpgsqlCommand command = new NpgsqlCommand("select * from tablea", conn); try { NpgsqlDataReader dr = command.ExecuteReader(); while(dr.Read()) { int = dr.getInt32(0); NpgsqlCommand command2 = new NpgsqlCommand("select * from tableb where id = " + id, conn); dr2.read();.........close(); } } finally { conn.Close(); } |
|
RE: executeReader duda [ reply ]
By: Josh Cooley on 2007-02-27 13:03[forum:1002205]
No.
Solamente un NpgsqlDataReader activo por la conexión se permite.
==============
Only one active NpgsqlDataReader per connection is allowed.
| refcursor returning <unnamed portal #> [ reply ] By: Patrick Greenwald on 2006-09-15 22:19 | [forum:1001767] |
|
I have a very simple procedure that doesn't take any parameters, and returns a refcursor. It worked fine in 0.98.2 but is "Broken" in 0.99.2 and 0.99.3 I did look at Keith Kikta's post, but since I am not using input parameters, the solution didn't seem applicable. I looked in the release notes, but didn't see any mention of changes to refcursor handling. My procedure looks like: CREATE OR REPLACE FUNCTION eventsselectall() RETURNS refcursor AS $BODY$ DECLARE retval refcursor; BEGIN OPEN retval FOR SELECT * FROM events; RETURN retval; EXCEPTION WHEN others THEN RETURN NULL; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; The code that works in Beta but not RC is: using (NpgsqlConnection cn = new NpgsqlConnection(connectString)) { cn.Open(); using (NpgsqlTransaction transaction = cn.BeginTransaction()) { using (NpgsqlCommand cmd = new NpgsqlCommand()) { cmd.Connection = cn; cmd.CommandText = "eventsselectall"; cmd.Transaction = transaction; cmd.CommandType = System.Data.CommandType.StoredProcedure; using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd)) { using (ds = new System.Data.DataSet()) { da.Fill(ds); foreach (System.Data.DataRow row in ds.Tables[0].Rows) { Console.WriteLine("(data adapter) {0}:{1}", row[0].ToString(), row[0].GetType()); } } } } } } I'm suprised that I haven't seen more feedback on this before now. I did run the log in debug mode, and both (RC2 and Beta2) log files were identical. Patrick |
|
| migrating from MySql [ reply ] By: Roberto Linares on 2007-02-09 21:03 | [forum:1002154] |
|
I was working for a long time on MySql and connecting to it with C# with MySqlConnector.Net. From MySql o my C# project, I used the command 'SHOW TABLES' to get, like a query, all the names of the tables from the selected database. With this, I automatically filled a DataSet with all the tables from a database. Now, I'm migrating to PostgreSql and using Npgsql to connect to a database from C# but PostgreSql doesn't have a 'SHOW TABLES' command!!!. My question is: How can I know wich are the table names from a database from my C# project using Npgsql and fill a DataSet automatically with them? |
|
RE: migrating from MySql [ reply ]
By: Josh Cooley on 2007-02-09 21:13[forum:1002155]
Npgsql supports the GetSchema method on the connection. Call connection.GetSchema("Tables", new string[]{});
You can put restrictions on the tables returned by putting strings in the second argument.
1- catalog
2 - schema
3 - table name
4 - table type
RE: migrating from MySql [ reply ]
By: Roberto Linares on 2007-02-21 23:49[forum:1002190]
Thanks for the help!!!
Is exactly what I was looking for. But it doesn't works jet:
What about the restrictions?
When I use the tablename restriction, the GetShema method also includes in the list another names (that are not names of tables from my database) to the tablename collection. How can I filter this?(maybe using a preffix for the names of my tables and retrieving only the strings that have that preffix on the collection returned from GetShema())RE: migrating from MySql [ reply ]
By: Josh Cooley on 2007-02-22 04:21[forum:1002191]
Make sure you also filter by catalog. GetSchema will return all of the tables on the server if you don't use any filtering. You can also filter by schema to make sure you don't get tables or views in information_schema or some other schema in your database. You may have created your tables in the public schema.
This would give you a call that looks like this:
connection.GetSchema("Tables", new string[]{"mydb", "public"});
This returns a DataTable containing all of the tables and views in mydb for the public schema.
| No NpgsqlConnection.Notification function???? [ reply ] By: steven floyd on 2007-02-20 23:40 | [forum:1002187] |
|
Trying to follow the simple example for Synchronous notifications. The example has: conn.Notification += new NotificationEventHandler(NotificationSupportHelper); I am using visual basic 2005 and the member function .Notification does not seem to exist?? Any ideas? Thanks |
|
RE: No NpgsqlConnection.Notification function???? [ reply ]
By: steven floyd on 2007-02-21 00:56[forum:1002188]
Found the problem...
Notification is not a function it's an event!! ( New to this programing stuff)
The code:
conn.Notification += new NotificationEventHandler(NotificationSupportHelper);
translates to visual basic:
AddHandler conn.Notification, AddressOf NotificationSupportHelper
All fixed works well!
| connection actively refused [ reply ] By: glok twen on 2007-02-16 02:06 | [forum:1002177] |
|
hi. i downloaded and started to use npgsql - the ms20 version 1.0.0.0 version. i keep getting a connection refused on the initial connection. what's puzzling is i run pgadmin3 with the equivalent connection string from the same xp box and it connects no problem. have i missed something? what things would you check first to narrow down the cause? thanks, gt |
|
RE: connection actively refused [ reply ]
By: glok twen on 2007-02-16 03:22[forum:1002178]
seems to be resolved ... looks like it was a firewall issue on the source machine (even tho the exception implies it's the target machine that refused the connection)
| Latest Npgsql 1.0 release? [ reply ] By: Simon W on 2007-02-10 15:14 | [forum:1002157] |
|
Hi, Which is the latest of Npgsql 1.0? I currently use 1.0 (2006-10-08) however I'm getting "System.NotSupportedException: This stream does not support seek operations" exceptions in multi-threaded applications which I thought was fixed in 1.0 RC3 Thanks |
|
RE: Latest Npgsql 1.0 release? [ reply ]
By: Francisco Figueiredo jr. on 2007-02-11 12:36[forum:1002160]
Hi Simon.
The latest version is 1.0 from 2006-10-08 as you said. It is strange you are getting this problem...
Is it possible that your application may be using some previous Npgsql version?
Can you try to get the latest cvs code, compile it and give it a try?
RE: Latest Npgsql 1.0 release? [ reply ]
By: Simon W on 2007-02-14 12:04[forum:1002173]
Hi,
I've confirmed that it is loading the final 1.0 release within the application, although there are a couple of older copies of the assembly on the machine.
Didn't have much success with the CVS release, builds ok although it was hanging on connect to the database#
For the time being I’ve reverted to a single thread app although I’ll try to create a simplified sample app to replace the error
Thanks
Simon
RE: Latest Npgsql 1.0 release? [ reply ]
By: Josh Cooley on 2007-02-14 13:25[forum:1002174]
Simon,
In your multithreaded app, how long are you holding on to the connections? Is there a single connection shared among threads? Do you rely on the built in connection pooling?
How often do you get the NotSupportedException? Is it always around a particular type of operation?
JoshRE: Latest Npgsql 1.0 release? [ reply ]
By: Simon W on 2007-02-14 13:40[forum:1002175]
Hi Josh,
The app in question runs ok multi-threaded with a connection made per thread with no problem. The connections come from a pool and can stay open for upto about 2 hours which is the lifespan of the thread (this seems quite content with .net 2 where as .net 1.1 had problems).
The area I'm having a problem with, the 2 threads share a single connection (from a pool), this is where I believe my problems lie as a connection per thread seems fine.
Operations performed are simple inserts only (app basically does a large amount of data processing from another source and saves output to postgres). Once the exception starts to throw, it throws on every database operation performed however it happily runs for 2 or 3 minutes performing inserts before throwing the exceptions.
Thanks
Simon
RE: Latest Npgsql 1.0 release? [ reply ]
By: Francisco Figueiredo jr. on 2007-02-14 14:43[forum:1002176]
Simon, do you have the sync notification flag turned on in your connection string?
The seek operation problem which was fixed occurs when you are using the sync notification thread. It is basically a problem where Npgsql left data in the stream while working with sync thread.
Maybe in your multithread app, Npgsql is lefting some other data in the stream for another reason. That would explain why you are getting this error again with 1.0 final.
| Synchronous notification blocks GC [ reply ] By: Maarten Claes on 2007-02-08 10:19 | [forum:1002145] |
|
Hello, I've a static connection with an attached notification eventhandler. When the connection object is processed by the GC, the connections thread is blocked at the line marked with '>>>>>' and the application hangs: <code> internal void RemoveNotificationThread() { // Wait notification thread finish its work. >>>>>> _notificationAutoResetEvent.WaitOne(); // Kill notification thread. _notificationThread.Abort(); _notificationThread = null; // Special case in order to not get problems with thread synchronization. // It will be turned to 0 when synch thread is created. _notificationThreadStopCount = 1; } </code> I've tried unregistering the eventhandler and closing the connection before it's destroyed by the GC. But the problem remains. Sometimes it does block and sometimes it doesn't. I don't know when (seems to be random). Kind regards, Maarten Claes |
|
RE: Synchronous notification blocks GC [ reply ]
By: Josh Cooley on 2007-02-08 15:40[forum:1002146]
Maarten,
Are you calling Close or Dispose on the static connection in a finalizer? If so, remove that call since that can cause this type of behavior.
If this is not the case, are you calling Close or Disposeon the static connection somewhere else? Where?
JoshRE: Synchronous notification blocks GC [ reply ]
By: Francisco Figueiredo jr. on 2007-02-08 20:59[forum:1002149]
Hmmm,
When GC is collecting the connection object, there is no guarantee that the sync thread will be alive at that time, I mean, it may have been already collected. That`s why you have a random perception of this problem, Maarten. For sure there must be some check for that when removing the sync thread so this don't happen.
Maybe a null check would be enough??
if (_notificationThread == null)
return;
RE: Synchronous notification blocks GC [ reply ]
By: Maarten Claes on 2007-02-09 09:08[forum:1002153]
After a lot of debugging, I found the problem. You may not use the same connection object inside the notification handler to execute a command! If you do, StopNotificationThread will be called (and _notificationAutoResetEvent.WaitOne();). This will block the notification thread (and notification handler which is run on that thread). Because the thread is blocked, the connection.Close will also block...
So, calling a command.execute on the same (notification listening) connection will cause a hardlock in the connection. Can you add this to the manual?
Thanks for your support!
Maarten
@Josh
I keep a static list of objects and a static connection to listen. The static connection is created when the first item is added to the list. The connection will be closed when de last object is removed from the list (on dispose of the object). So connection.close is only called once.
@Francisco
When the GC collects the connection object, the thread is alive. Who can abort it? The GC won't kill the thread because there's still a reference inside the connection object. Only the thread.abort will stop the thread.RE: Synchronous notification blocks GC [ reply ]
By: Francisco Figueiredo jr. on 2007-02-11 12:26[forum:1002159]
Hi Maarten!
Nice catch! Indeed the notification thread doesn't support recurrence. I will add that to Npgsql User manual.
I think Npgsql could do something about that. Maybe checking if the notification thread is the current one who is doing the call and so, don't wait for notification thread...
Connection object gc collection is really a problem. And checking it better, I think Npgsql could leak a thread if the connection is GC'ed. The thread is only cleared if the connection is explicitly closed/disposed. This need fixing... Maybe adding a code to destroy the notification thread in the Dispose when calling dispose(false).
Thank you, Maarten, for your feedback.
| Missing Namespace [ reply ] By: Marc O'Neill on 2007-02-08 00:38 | [forum:1002140] |
|
Im trying to use Npgsql in a windows C# application. The promlem is i recieve the following error The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?) I have added to the GAC and I am using the using Npgsql declaration but still no joy. Any help would be great. Im using vs2005. Thanks Marc |
|
RE: Missing Namespace [ reply ]
By: Josh Cooley on 2007-02-08 05:16[forum:1002141]
Marc,
You need to be sure your project has a reference to Npgsql. You should be able to right click on your project and choose "Add Reference...". You will likely need to browse to the copy on your machine that is not in the gac. This will be used for building, but the version in the gac will be used for runtime.
JoshRE: Missing Namespace [ reply ]
By: Francisco Figueiredo jr. on 2007-02-08 20:25[forum:1002148]
Hi Marc.
Did you remember to add Mono.Security.dll to GAC too? As Npgsql uses Mono.Security, I think ms.net may be complaining about that.
I hope it helps.
RE: Missing Namespace [ reply ]
By: Marc O'Neill on 2007-02-08 22:15[forum:1002150]
Thanks for your help it complied fine for a windows application but im really trying to devlop a mobile application to run in the device emulator and when i complie i get the following error
error CS0012: The type 'System.Data.IDbCommand' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral'.
I have added the dll but no joy has any done this before is it even possible???
RE: Missing Namespace [ reply ]
By: Josh Cooley on 2007-02-08 22:25[forum:1002151]
Marc,
We don't support the compact framework. A workaround to this is splitting your data access from the rest of your app and build a web service.
JoshRE: Missing Namespace [ reply ]
By: Marc O'Neill on 2007-02-08 22:49[forum:1002152]
Its not majorly feasible for the type of application im creating.
I fixed that error but im getting a disk full or write protected error now.
Deployment and/or registration failed with error: 0x8973190e. Error writing file '\Windows\NETCFV2.ppc.armv4.cab'. Error 0x80070070: There is not enough space on the disk.
This is starting to become a nightmare.
| Compiling Error on Mono 2.0 [ reply ] By: Kadri Kalemci on 2007-02-06 21:46 | [forum:1002136] |
|
I have a development platform on Debian with Mono 2.0 Framework. I'm using Monodevelop.. I have a postgreSql server and I want to connect that server using npgsql 1.0 that is installed on GAC. When I make a reference to npgsql.dll from a project, monodevelop builds that project but when I started the project, following error occured: ** (/home/kadri/Projects/Intimatek/Testing/bin/Debug/Testing.exe:16727): WARNING **: Missing method .ctor in assembly /home/kadri/Projects/Intimatek/Testing/bin/Debug/Npgsql.dll, type System.Runtime.CompilerServices.RuntimeCompatibilityAttribute ** ERROR **: Can't find custom attr constructor image: /home/kadri/Projects/Intimatek/Testing/bin/Debug/Npgsql.dll mtoken: 0x0a00016e aborting... Stacktrace: at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00004> ************************************* What's the problem? How can I solve this? |
|
RE: Compiling Error on Mono 2.0 [ reply ]
By: Kadri Kalemci on 2007-02-07 09:42[forum:1002137]
OK..
we found :)
may be, that was our fault..
In monodevelop, you must select correct version of runtime..
To do this, open project options (on menu: Project/Options) .. In generals, Runtime Options , select version 2.0..
Every thing is working..
RE: Compiling Error on Mono 2.0 [ reply ]
By: Francisco Figueiredo jr. on 2007-02-08 20:23[forum:1002147]
Hi, Kadri.
I'm glad you got it working.
If you have any problems, please, let us know.
| Npgsql Visual Studio 2005 [ reply ] By: Jean-Baptiste Raynaud on 2007-01-31 10:57 | [forum:1002126] |
|
Hi, I donwloaded the Npgsql1.0-bin-ms2.0 version, and I use it for an ASP.NET application builded with VS 2005 an framework .NET 2.0. Is it possible to use a NpgsqlConnection or NpgsqlDataAdapter as visual component in VS 2005? I didn't find how to do this. I tried also to create a connection to a Postresql database with an ODBC or OLEDB driver but it doesn't work. The OLEDB connection doesn't work, and the ODBC Connection seems to work but the "Tables" section is empty... It's not very useful because I have to create my connection and write my queries directly into my C# code, and I use a loop on the datareader to fill each page's component like combo, gridview... I hope there's a solution to do this in an easier way... Thanks. |
|
RE: Npgsql Visual Studio 2005 [ reply ]
By: Josh Cooley on 2007-01-31 13:40[forum:1002128]
The 1.0 version has designer support for 2003. We are working on 2.0 which is where we will be putting 2005 designer support. For now, you have to hand code what the designer would generate.
You can still use the NpgsqlDataAdapter and fill DataSets for data binding.
| CommandBehavior.SchemaOnly not working [ reply ] By: Andrus Moor on 2007-01-28 21:52 | [forum:1002119] |
|
FYIReporting RDLDesigner executes select commands containing limit clauses using ExecuteReader(CommandBehavior.SchemaOnly) This causes npgsql ExecuteReader to add LIMIT 0 clause to statement sent to PostgreSQL. npgsql generates invalid SELECT statement. Any idea how to fix this ? Code to reproduce: using System.Data; using Npgsql; class Program { static void Main() { Npgsql.NpgsqlConnection conn = new NpgsqlConnection( "ENCODING=UNICODE;SERVER=localhost;DATABASE=postgres;" + "USER ID=postgres"); conn.Open(); IDbCommand cmd = new Npgsql.NpgsqlCommand( "select * from pg_tables limit 1", conn); cmd.ExecuteReader(CommandBehavior.SchemaOnly); } } Observed: Message="ERROR: 42601: syntax error at or near \"limit\"" ErrorSql="select * from pg_tables limit 1 limit 0;" |
|
RE: CommandBehavior.SchemaOnly not working [ reply ]
By: Francisco Figueiredo jr. on 2007-01-30 14:09[forum:1002123]
Hi Andrus!
This is a know limitation of Npgsql. We still need to check if there is any user provided limit clause before adding our to implement SchemaOnly behavior.
Is it possible for you to remove or schemaonly or the limit clause when calling executereader?
RE: CommandBehavior.SchemaOnly not working [ reply ]
By: Andrus Moor on 2007-01-30 16:38[forum:1002125]
About removing SchemaOnly:
Open Source www.fyireporting.com uses SchemaOnly clause.
Is supports a lot of DBMS and this works with all others.
Designer needs to retireve only schema from sql statement without parsing SQL .
There is NO other way to obtain schema only without parsing SQL statement.
About removing LIMIT:
I use LIMIT to get first report page of large table.
The only other way is to use SELECT TOP clause . SELECT TOP requires ORDER BY.
This forces PostgreSQL to sort huge amout of data as is painfully slow and thus not acceptable.
| Using IN() in Prepared Statements [ reply ] By: s andaya on 2006-06-20 15:35 | [forum:1001460] |
|
Is there a way to do IN() as a prepared statement? i.e.: "SELECT * FROM table WHERE id IN (:listvalue)" "command.Parameters["listvalue"].Value = new int[2] {1,2};" I saw a thread from 2004 and the answer was "no" back then.... Thanks! |
|
RE: Using IN() in Prepared Statements [ reply ]
By: Francisco Figueiredo jr. on 2006-06-21 15:02[forum:1001465]
Hi s andaya!
Unfortunately we didn't make much progress about that. We are still missing array type support. :(
Please, if possible, fill a feature request about that so it don't get lost.
Thanks in advance.RE: Using IN() in Prepared Statements [ reply ]
By: d na on 2007-01-30 13:12[forum:1002122]
Any news on this feature request? RE: Using IN() in Prepared Statements [ reply ]
By: Francisco Figueiredo jr. on 2007-01-30 14:25[forum:1002124]
Hi d na!
Not yet. We didn't play with this feature request yet.
We hope to be able to work on that soon. We will let you know when we have something about it. Sorry for any problems.
| Missing Resouce in Npgsql 2.0 [ reply ] By: Thomas Burkhart on 2007-01-18 13:18 | [forum:1002104] |
|
Hi, I just test the DbProvider architecture. I was quite suprised when I got a really strange exception: DScanTests.DatabaseCoreTest.TestDbProviderFactory : System.Resources.MissingManifestResourceException : Für die angegebene Kultur oder die neutrale Kultur konnten keine Ressourcen gefunden werden. Stellen Sie sicher, dass Npgsql.NpgsqlConnectionString.resources beim Kompilieren richtig in die Assembly Npgsql eingebettet wurde, oder dass die erforderlichen Satellitenassemblys geladen werden können und vollständig signiert sind. This means, that a requested resouce string is not availabe in my culture. I tracked it down, it happens here System.Resources.ResourceManager.GetString(String name) Npgsql.NpgsqlConnectionString.ParseConnectionString(String CS) in C:\Entwicklung\DScan V2\Npgsql2\src\Npgsql\NpgsqlConnectionString.cs:Zeile 129. Npgsql.NpgsqlConnection.set_ConnectionString(String value) in C:\Entwicklung\DScan V2\Npgsql2\src\Npgsql\NpgsqlConnection.cs:Zeile 232. CMT.DScan.DocEditor.DatabaseManager.getDbProviderFactory() in C:\Entwicklung\DScan V2\DocumentEditor\DatabaseManager\DatabaseManager.cs:Zeile 176. DScanTests.DatabaseCoreTest.TestDbProviderFactory() in C:\Entwicklung\DScan V2\DScanTests\DatabaseCoreTest.cs:Zeile 278. // Check if there is a key-value pair. if (keyvalue.Length != 2) { throw new ArgumentException(resman.GetString("Exception_WrongKeyVal"), Key); } What I don't understand is, why I don't get the fallback resource that exists in english if my german ressource is not available. Cheers Thomas |
|
RE: Missing Resouce in Npgsql 2.0 [ reply ]
By: Francisco Figueiredo jr. on 2007-01-18 19:46[forum:1002107]
Hmmmm, strange...
We had this problem before. The resource wasn't really there. I will make some tests to see if I get this problem. I'm now at my job and have no access to my dev machine. I will reply you back about it.RE: Missing Resouce in Npgsql 2.0 [ reply ]
By: Thomas Burkhart on 2007-01-18 20:21[forum:1002109]
Hi Francisco,
I found out later this day that I had to click on the resource file in VS and choose Include into project. After a rebuild it worked fine. So it looks like if the CVS version does not automatically include all resources or that some VS config file may be missing. Unfortunately I have not much experiences with resources under .net.
Did you get my email concering bugs in your blog about the DataProviderFactory?
Cheers
ThomasRE: Missing Resouce in Npgsql 2.0 [ reply ]
By: Francisco Figueiredo jr. on 2007-01-18 21:06[forum:1002110]
Hmmm, I will update vs.net project file to include this file. Would you mind to create a diff of your project file and cvs version?
I received your email. I will update my blog tonight. The strange part is that it worked on Mono. Maybe the ms.net 2.0 is a little bit different?
Anyway, thanks for your feedback!
RE: Missing Resouce in Npgsql 2.0 [ reply ]
By: Thomas Burkhart on 2007-01-19 08:29[forum:1002112]
Yes it sems so that Mono is in this respect different, perhaps it would be a good idea to point this out to the Mono Developers.
Anyway, I refactored my whole application to the Generic DataProvider Interface and all my Nunit Tests show gree. Great work!!
As I will now continue to work with Npsgsql 2.0 you will get a lot of feedback :-)
Cheers
ThomasRE: Missing Resouce in Npgsql 2.0 [ reply ]
By: Francisco Figueiredo jr. on 2007-01-19 14:06[forum:1002114]
Hi Thomas!
I'm glad to know you got it working!
I already updated my blog with your information. I will check with Mono guys to see why the difference.
Thank you for your feedback!
| Feature request [ reply ] By: Alejandro Gasca on 2007-01-19 10:50 | [forum:1002113] |
|
Hi. I'm not sure this is a valid feature request, but, can you add an exception when putting an invalid parameter in the connection string? I put Encodnig=UNICODE instead of Encoding=UNICODE, don't see the error and... well... i was unable to locate the error in the malformed accented string... Thanks. Alejandro |
|
| Help modifying npgsql [ reply ] By: Alejandro Gasca on 2006-11-21 15:12 | [forum:1001942] |
|
Hi, i have this overloads of this methos of NpgsqlCommandBuilder: GetUpdateCommand (DataRow row, string[] queLlave) GetDeleteCommand (DataRow row, string[] queLlave) Which are (almost) copies of the original methos; this methos make a simplification of the string sended to the server. Ok. I insert this overloads in NpgsqlCommandBuilder.cs, and modify the AssemblyInfo by increasing the revision number. But, as i see in "Price of the npgsql?" this is not recommended. Meaby, deriving from NpgsqlCommandBuilder will resolve this situation, but, i use the same class memebers if the original Get*Commands, so, to work this class members must be turn to public / protected: BuildSchema, GetQuotedName, QualifiedTableName and select_schema... of couse, remove the sealed modifier of NpgsqlCommandBuilder... So, witch are the options for the tiny changes i do? -- just change revision? -- change dll name? -- ? Thanks, Alejandro. |
|
RE: Help modifying npgsql [ reply ]
By: Josh Cooley on 2006-11-27 01:38[forum:1001969]
Alejandro,
If you need to modify one of the delivered classes, then you're going to be maintaining a fork for that class no matter what.
If you are using the 2.0 framework, you may be able to derive from DbCommandBuilder to create your own command builder. There is no reason you couldn't write a different command builder from scratch.
JoshRE: Help modifying npgsql [ reply ]
By: Alejandro Gasca on 2007-01-16 02:46[forum:1002099]
Hi.
I'm trying to make my command builder derived by dbCommandBuilder...
I was no clue on doing this... i see your cvs code and see what you see.
How can i use NpgsqlTypesHelper.GetNativeTypeInfo?
And, a question: I don't see how the two overloads of the getupdatecommand and get getdeletecommand breaks the lpgl? it says:
"Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library."
So, *adding* these overloads do not break other code...
I say this because the problem of make a new commandbuilder is, in my oppinion, grater than ading some lines (actually like 160), so maintainig the fork is easy.
So why to do a new one if a good one exists, the modifications are minimal, and do not break code?
In this moment, i'm changing the version to 1.0.0.1
thanks.RE: Help modifying npgsql [ reply ]
By: Josh Cooley on 2007-01-16 03:44[forum:1002100]
NpgsqlTypesHelper.GetNativeTypeInfo is a method on an internal class. It's not exposed to external assemblies.
Your changes don't break the lgpl. You simply have to deliver your source code with any changed npgsql binaries.
You should probably sign your version with a different key than what we release. We may release a version labeled 1.0.0.1. Using a different key will ensure that there isn't any confusion between two apps that depend on different releases.
RE: Help modifying npgsql [ reply ]
By: Francisco Figueiredo jr. on 2006-11-29 19:53[forum:1001998]
Also, when creating your commandbuilder, you could use composition on NpgsqlCommandBuilder, instead of using inheritance. This way, you could simply delegate to NpgsqlCommandBuilder when implementing commandbuilder methods.
If you use composition, your code will still be an "user" of the library, and so, won't have problems with LGPL licensing.
I hope it helps.
RE: Help modifying npgsql [ reply ]
By: Alejandro Gasca on 2007-01-16 05:47[forum:1002101]
Ok, thanks, i will use another keyfile to aviod this problem.
Alejandro
| Protocol option not supported in MONO [ reply ] By: Andrus Moor on 2007-01-13 16:34 | [forum:1002094] |
|
Today I started to receive error Protocol option not supported when running Npgsql1.0 with MONO Error occurs in line Connection.Open(); Npgsql1.0 source code and docs does not contain such message. When running under .NET this error does not occur. It occurs even if PostgreSQL server is not running. Any idea how to fix it ? Code where error occurs is: public static void CreateConnection(string Server, string Database, string User, string Password) { NpgsqlEventLog.Level = LogLevel.Debug; NpgsqlEventLog.LogName = @"c:\NpgsqlLogFile.txt"; if (Connection != null) Connection.Close(); ConnectionString = "ENCODING=UNICODE;" + "SERVER=" + Server + ";" + "DATABASE=" + Database + ";" + "USER ID=" + User + ";" + "PASSWORD=" + Password + ";"; Connection = new NpgsqlConnection(ConnectionString); IDbCommand Command = new NpgsqlCommand(@" SET search_path TO firma1,public; SELECT sfirmanimi FROM prpalk", (NpgsqlConnection)Connection); // Follwing line causes error Protocol Option not supported in MONO Connection.Open(); } Stack trace: Protocol option not supportedStack trace: at Npgsql.NpgsqlClosedState.Open (Npgsql.NpgsqlConnector context) [0x00000] at Npgsql.NpgsqlConnector.Open () [0x00000] at Npgsql.NpgsqlConnectorPool.GetPooledConnector (Npgsql.NpgsqlConnection Connection) [0x00000] Log file: 13.01.2007 18:12:45 2364 Debug Entering NpgsqlConnection.NpgsqlConnection(NpgsqlConnection()) 13.01.2007 18:12:45 2364 Debug ConnectionString Option: ENCODING = UNICODE 13.01.2007 18:12:45 2364 Debug ConnectionString Option: SERVER = localhost 13.01.2007 18:12:45 2364 Debug ConnectionString Option: DATABASE = mydb 13.01.2007 18:12:45 2364 Debug ConnectionString Option: USER ID = admin 13.01.2007 18:12:45 2364 Debug ConnectionString Option: PASSWORD = p 13.01.2007 18:12:45 2364 Debug Entering NpgsqlCommand.NpgsqlCommand() 13.01.2007 18:12:45 2364 Debug Entering NpgsqlParameterCollection.NpgsqlParameterCollection() 13.01.2007 18:12:45 2364 Debug Set NpgsqlCommand.Transaction = 13.01.2007 18:12:45 2364 Debug Entering NpgsqlConnection.Open() 13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance 13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance 13.01.2007 18:12:46 2364 Debug Entering NpgsqlClosedState.Open() 13.01.2007 18:12:46 2364 Debug Get NpgsqlClosedState.Instance |
|
| Selecting a field that is null [ reply ] By: Curtis Scheer on 2007-01-11 20:22 | [forum:1002092] |
|
What is the proper way to select a varchar field as a null value. for instance this doesn't return any rows cmd.Parameters.Add("desc",NpgsqlDbType.Char).Value = Nothing cmd.Parameters.Item("desc").IsNullable = True cmd.CommandText = "select * from foo where description = :desc" Reader = cmd.ExecuteReader() Do While Reader.Read MsgBox(Reader.Item("fooid")) Loop is the only way to get null values to use the is null keyword like so "select * from foo where description is null" Thanks, Curtis |
|
RE: Selecting a field that is null [ reply ]
By: Josh Cooley on 2007-01-12 01:02[forum:1002093]
Using "is null" is the only way to get rows back where the value is null.
| How to generate a typed dataset? [ reply ] By: Sascha Storzum on 2007-01-11 10:30 | [forum:1002088] |
|
Hi, I work wirh SharpDevelop2 and need to generate a typed dataset. With the SQLDataAdapter I can generate it over a attribute in the SQLDataAdapter. In the npgsqlDataAdapter I don`t see such an attribute. Thanks for any hints. Greets Storzi |
|
RE: How to generate a typed dataset? [ reply ]
By: Josh Cooley on 2007-01-11 13:41[forum:1002089]
We haven't built a designer for that purpose. You can build one yourself by saving the schema from an untyped DataSet built from your query. Then use a tool to generate the typed dataset from the xsd. This tool is called xsd.exe in the Microsoft SDK. RE: How to generate a typed dataset? [ reply ]
By: Sascha Storzum on 2007-01-11 14:55[forum:1002090]
Thanks a lot.
That will do it.
| Unhandled Exception when trying to pull a SQ [ reply ] By: Sascha Storzum on 2007-01-09 20:28 | [forum:1002083] |
|
Hi, I get a unhandled exception when I try to pull a NpgsqlConnection into a formular. I have installed the Npgsql - Assembly (1.0) with gacutil2 and put the NpgsqlConnection in the sidebar. .NET Version : 2.0.50727.42 OS Version : Microsoft Windows NT 5.1.2600 Service Pack 2 Current culture : German (Germany) (de-DE) Current UI language : en Working Set Memory : 75204kb SharpDevelop Version : 2.0.0.1710 Failed to create component 'NpgsqlConnection'. The error message follows: 'System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Das System kann die angegebene Datei nicht finden. File name: 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' at Npgsql.NpgsqlConnection..ctor(String ConnectionString) at Npgsql.NpgsqlConnection..ctor() WRN: Protokollierung der Assemblybindung ist AUS. Sie können die Protokollierung der Assemblybindungsfehler aktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) auf 1 festlegen. Hinweis: Die Protokollierung der Assemblybindungsfehler führt zu einer gewissen Leistungseinbuße. Sie können dieses Feature deaktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] entfernen. ' Exception thrown: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Das System kann die angegebene Datei nicht finden. File name: 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' at Npgsql.NpgsqlConnection..ctor(String ConnectionString) at Npgsql.NpgsqlConnection..ctor() WRN: Protokollierung der Assemblybindung ist AUS. Sie können die Protokollierung der Assemblybindungsfehler aktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) auf 1 festlegen. Hinweis: Die Protokollierung der Assemblybindungsfehler führt zu einer gewissen Leistungseinbuße. Sie können dieses Feature deaktivieren, indem Sie den Registrierungswert [HKLM\Software\Microsoft\Fusion!EnableLog] entfernen. --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at System.SecurityUtils.SecureConstructorInvoke(Type type, Type[] argTypes, Object[] args, Boolean allowNonPublic, BindingFlags extraFlags) at System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.TypeDescriptor.CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args) at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name) at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType) at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host) at System.Drawing.Design.ToolboxItem.CreateComponentsCore(IDesignerHost host, IDictionary defaultValues) at System.Drawing.Design.ToolboxItem.CreateComponents(IDesignerHost host, IDictionary defaultValues) at System.Windows.Forms.Design.OleDragDropHandler.CreateTool(ToolboxItem tool, Control parent, Int32 x, Int32 y, Int32 width, Int32 height, Boolean hasLocation, Boolean hasSize, ToolboxSnapDragDropEventArgs e) |
|
RE: Unhandled Exception when trying to pull a [ reply ]
By: Sascha Storzum on 2007-01-09 20:42[forum:1002084]
OK.
My mistake.
I also have to put Mono.Security.dll in the Assembly.
Now it works.
| Windows 98 and SSL problem [ reply ] By: Pawel Michalowski on 2006-12-20 10:25 | [forum:1002038] |
|
Hello, I wrote client application which connects to PostgreSQL servier via npgsql. The application is simple - it gets from server some info about people with given first/lastname. The application works with no problem on WindowsXP, however on Windows98 it just hangs up without any exception. PostgreSQL version is 8.2.0 and is configured to use SSL. Npgsql version is 1.0. From the behaviour of the application it seems that it hangs when opening connection. I enabled logging in npgsql and the last entries from it are: ---------------------------------------------------------- Debug Entering NpgsqlStartupPacket.NpgsqlStartupPacket() Debug Entering NpgsqlStartupPacket.WriteToStream() Debug Entering NpgsqlStartupPacket.WriteToStream_Ver_3() Debug Entering PGUtil.WriteString() Debug String written: user. Debug Entering PGUtil.WriteString() Debug String written: LuxDataSearcherAdmin. Debug Entering PGUtil.WriteString() Debug String written: database. Debug Entering PGUtil.WriteString() Debug String written: LuxDataSearcher. Debug Entering PGUtil.WriteString() Debug String written: DateStyle. Debug Entering PGUtil.WriteString() Debug String written: ISO. ---------------------------------------------------------- Last entries from server log: ---------------------------------------------------------- DEBUG: 00000: forked new backend, pid=19719 socket=12 LOCATION: BackendStartup, postmaster.c:2573 192.168.15.65 /usr/local/pgsql/bin/postgres DEBUG: 00000: SSL connection from "(anonymous)" 192.168.15.65 /usr/local/pgsql/bin/postgres LOCATION: open_server_SSL, be-secure.c:946 DEBUG: 00000: reaping dead processes LOCATION: reaper, postmaster.c:2010 DEBUG: 00000: server process (PID 19719) exited with exit code 1 LOCATION: LogChildExit, postmaster.c:2417 ---------------------------------------------------------- Are there any issues in case of Windows 98 I should be aware of? Any help will be very appreciated. |
|
RE: Windows 98 and SSL problem [ reply ]
By: Francisco Figueiredo jr. on 2006-12-26 11:50[forum:1002048]
Hi Pawel.
What ms.net version do you have installed on win98?
I don't remember of any specific issue with win98 right now.RE: Windows 98 and SSL problem [ reply ]
By: Pawel Michalowski on 2007-01-04 08:42[forum:1002071]
Hello Francisco
I installed the newest version of .NET 2.0 available from Microsoft.RE: Windows 98 and SSL problem [ reply ]
By: Francisco Figueiredo jr. on 2007-01-04 14:12[forum:1002074]
Hi Pawel.
Can you try the following: Download latest Mono binaries from http://mono.ximian.com/daily/ and replace the Mono.Security.dll assembly. Maybe you can get better results with a newer assembly.
Please, let me know if it worked for you.
I hope it helps.
RE: Windows 98 and SSL problem [ reply ]
By: Francisco Figueiredo jr. on 2007-01-04 14:12[forum:1002075]
Binaries are on monocharge-xxx file.
RE: Windows 98 and SSL problem [ reply ]
By: Josh Cooley on 2006-12-27 03:47[forum:1002052]
We use BeginConnect to establish the connection. There may be a problem with establishing a socket connection asynchronously on windows 98. I don't believe the win32 async socket API was available in win98. And since that is what the ms.net framework is build on, the emulation could be buggy. We are working on a patch to the connection code that may help you out. RE: Windows 98 and SSL problem [ reply ]
By: Pawel Michalowski on 2007-01-04 08:50[forum:1002072]
Hello Josh
What about non SSL communication, do you use synchronous connection in this case? When I turn off SSL I can connect to the server with no problem.
Thanks for reply.RE: Windows 98 and SSL problem [ reply ]
By: Josh Cooley on 2007-01-04 14:00[forum:1002073]
I don't have windows 98, so I can't test it. I was just guessing before. If you connect without ssl and there are no problems, then it isn't a problem with BeginConnect.
| Why ContinueUpdateOnError is not implemented [ reply ] By: Andrus Moor on 2006-12-29 12:30 | [forum:1002055] |
|
.NET data provider must implement DataAdapter.ContinueUpdateOnError property in transaction. ContinueUpdateOnError requires that transaction continues after error. In this case .NET can mark all bad rows in DataGrid. User can see all errors together. Unfortunately inside transaction after error PostgreSQL returns message "Current transaction aborted, command ignored after end of transaction block" for all subsequent commands. npgsql does NOT have any support for fix this. It marks ALL subsequent commands as invalid. So npgsql cannot used as reliable .NET data provider. NpgsqlDataAdapter must invoke automatic SAVEPOINT / ROLLBACK TO SAVEPOINT commands if ContinueUpdateOnError is set. Why this is not implemented ? Andrus |
|
RE: Why ContinueUpdateOnError is not implemen [ reply ]
By: Josh Cooley on 2006-12-29 14:55[forum:1002057]
We haven't implemented all of the features for an ADO.NET provider. Please file a bug report.
Do you know what the initial exception is?
| Why exception is not catched [ reply ] By: Andrus Moor on 2006-12-24 18:07 | [forum:1002046] |
|
The following code causes error in Update() line Npgsql.NpgsqlException was unhandled by user code Why exception is not catched ? catch must catch all exceptions! ------ code: int RowsUpdated; try { RowsUpdated = datapter.Update(changes); } catch { System.Windows.Forms.MessageBox.Show("error"); transact.Rollback(); throw; } error message details are: Npgsql.NpgsqlException was unhandled by user code Message="ERROR: 23505: duplicate key violates unique constraint \"konto_pkey\"" Source="Npgsql" BaseMessage="duplicate key violates unique constraint \"konto_pkey\"" Code="23505" Detail="" ErrorSql="update \"firma1\".\"konto\" set \"kontonr\" = '2', .... File="nbtinsert.c" Hint="" Line="277" Position="" Routine="_bt_check_unique" Severity="ERROR" Where="" StackTrace: at Npgsql.NpgsqlConnector.CheckErrors() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 359 at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 410 at Npgsql.NpgsqlCommand.ExecuteCommand() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 1479 at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 633 at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 601 at System.Data.Common.DbDataAdapter.UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand dataCommand, StatementType cmdIndex) at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) |
|
RE: Why exception is not catched [ reply ]
By: Josh Cooley on 2006-12-27 03:38[forum:1002051]
I could reproduce the exception, but still caught it. RE: Why exception is not catched [ reply ]
By: Francisco Figueiredo jr. on 2006-12-26 11:46[forum:1002047]
Hi Andrus!
This is strange. Did you try that on Mono, or just on ms.net?
Did you try add an explicit catch for NpgsqlException?
Did you try to execute this code in a console app, instead of a windows forms?
RE: Why exception is not catched [ reply ]
By: Andrus Moor on 2006-12-29 12:33[forum:1002056]
VS2005 shows this error when application is running from ide in debug mode.
So this was my misunderstanding, I'm sorry.
Andrus.
| Connection Timeout and Invalid Startup Packet [ reply ] By: Stephen l on 2006-11-17 15:13 | [forum:1001932] |
|
Hi, I'm using Npgsql 1.0 with Postgresql 8.1 on Windows 2003 running .NET 1.1. Every hour or so depending on load, I get exception "Connection establishment timeout. Increase Timeout value in ConnectionString". The higher the load, the more timeouts I get. My connection string looks like this: SERVER=<IP>;PORT=5432;DATABASE=<DB>;USER ID=<user>;TIMEOUT=15;MINPOOLSIZE=1;MAXPOOLSIZE=20;PROTOCOL=3;CONNECTIONLIFETIME=60;ENCODING=UNICODE; Everytime this happens, I see "LOG: incomplete startup packet" in Postgresql at the precise time when the exception happened. The DB has plenty of empty connection slots available. The database sits on the same machine as the web application. The problem occurs when connecting to my other database servers on the network as well. The CPU, Memory and disk space & IO are perfectly in good health. A search on Postgresql list, seem to point to a bad client software. I didn't file a bug report yet because the BeginConnect() and WaitOne code in NpgsqlClosedState seem straightforward. I've tried disabling pooling, increase timeout (started from 1 sec to 20 secs), and the problem is still there. At lower timeout numbers, I get more timeout problems of course. Please help! |
|
| Reuse NpgsqlConnection object after close? [ reply ] By: Alexander Golikov on 2006-12-19 08:01 | [forum:1002034] |
|
Hi. I have read on this forum, that Close method is implemented by calling Dispose. So, I wandering - can I safely reuse NpgsqlConnection object after calling close method on it? Since after calling Dispose, my object existence depend on references to him and GC work. Also, may be you freed some other resources (like unmanaged ) in Dispose? Like this: NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=joe;Password=secret;Database=joedata;"); conn.Open(); /*Some work to do...*/ conn.Close(); conn.ConnectionString = "new con string here"; conn.Open(); ......... P.s. in UserManual.htm in "Synchronous notifications" section, "Syncnotification=true" not present in connection string, and not mentioned at all. |
|
RE: Reuse NpgsqlConnection object after close [ reply ]
By: Josh Cooley on 2006-12-20 03:12[forum:1002035]
Close doesn't call Dispose. It's actually the other way around. You should have no problem opening a connection again after it has been closed.
Thanks for the heads up on UserManual.htm.RE: Reuse NpgsqlConnection object after close [ reply ]
By: Alexander Golikov on 2006-12-20 06:36[forum:1002037]
Thanks! I replayed in this http://pgfoundry.org/forum/forum.php?thread_id=746&forum_id=518 topic, for not mislead ppl any more.
|
|
Older Messages |

