Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ODBC - .NET - Oracle RDB

127 views
Skip to first unread message

Jens Chr Juul Jensen

unread,
Mar 2, 2002, 11:46:05 AM3/2/02
to
help...

I'm using .Net with ODBC to connect to an Oracle RDB
database.

This works nicely as long as I only retreived numbers, as
soon as I touch a field containing Char or VarChar
the .Net replies with an unknown sqltype - 14

It works correct with a sqlserver odbc....

Code:

private void button2_Click(object sender,
System.EventArgs e)
{
string
myConnString= "DSN=Rdb_medlem;PWD=guesswhat;DBA=R";
string query = "SELECT navn from
TOTAL_STAMOPLYSNINGER";

DataSet dataset = new DataSet();
OdbcConnection conn = new
OdbcConnection(myConnString);

conn.Open();
OdbcDataAdapter adapter = new
OdbcDataAdapter();
adapter.SelectCommand = new
OdbcCommand(query, conn);


adapter.Fill
(dataset,"TOTAL_STAMOPLYSNINGER");
conn.Close();

dataGrid1.DataSource=dataset;
}


errror:
-----------------------------------------------------

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Unknown SQL type - 14.
at Microsoft.Data.Odbc.TypeMap.FromSqlType(SQL_TYPE
sqltype)
at Microsoft.Data.Odbc.OdbcDataReader.GetSqlType(Int32
i)
at Microsoft.Data.Odbc.OdbcDataReader.GetFieldType
(Int32 i)
at
System.Data.Common.SchemaMapping.SetupSchemaWithoutKeyInfo
(MissingMappingAction mappingAction, MissingSchemaAction
schemaAction, Boolean gettingData, DataColumn
parentChapterColumn, Object chapterValue)
at System.Data.Common.SchemaMapping.SetupSchema
(SchemaType schemaType, String sourceTableName, Boolean
gettingData, DataColumn parentChapterColumn, Object
parentChapterValue)
at System.Data.Common.DbDataAdapter.FillSchemaMapping
(Object data, String srcTable, IDataReader dataReader,
Int32 schemaCount, DataColumn parentChapterColumn, Object
parentChapterValue)
at System.Data.Common.DbDataAdapter.FillSchemaMappingTry
(Object data, String srcTable, IDataReader dataReader,
Int32 schemaCount, DataColumn parentChapterColumn, Object
parentChapterValue)
at System.Data.Common.DbDataAdapter.FillFromReader
(Object data, String srcTable, IDataReader dataReader,
Int32 startRecord, Int32 maxRecords, DataColumn
parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, String srcTable, IDataReader dataReader, Int32
startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.Fill(Object data,
Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet
dataSet, String srcTable)
at WindowsApplication3.Form1.button2_Click(Object
sender, EventArgs e) in c:\onlinesystem\windowsapplication3
\form1.cs:line 167
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs
mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage
(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc
(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.0.3705/mscorlib
.dll
----------------------------------------
WindowsApplication3
Assembly Version: 1.0.791.31781
Win32 Version: 1.0.791.31781
CodeBase:
file:///C:/OnlineSystem/WindowsApplication3/bin/Debug/Windo
wsApplication3.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/assembly/gac/system.windows.forms/1.0.3300
.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.3300.0__b77a5c5619
34e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.3300.0__b0
3f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.Data.Odbc
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.4030.0
CodeBase:
file:///c:/winnt/assembly/gac/microsoft.data.odbc/1.0.3300.
0__b77a5c561934e089/microsoft.data.odbc.dll
----------------------------------------
System.Data
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/assembly/gac/system.data/1.0.3300.0__b77a5
c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase:
file:///c:/winnt/assembly/gac/system.xml/1.0.3300.0__b77a5c
561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file
for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

-------------------------------------------------------

All help would be appreciated...
regards
jens chr juul jensen
KAD Denmark

Steven Bras [MS]

unread,
Mar 4, 2002, 3:47:29 PM3/4/02
to
Which ODBC driver are you using? If you are using Microsoft's ODBC driver
for Oracle, this driver does not support Oracle RDB. Please advise and I'll
continue to assist if necessary.

Steven Bras, MCSD
Microsoft Developer Support/Visual Basic WebData

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

Jens Chr Juul Jensen

unread,
Mar 4, 2002, 4:37:17 PM3/4/02
to

I'm using Oracle RDB's own ODBC driver, version 3.0.2.0.

When attaching to the odbc driver from excel everything
works.

When using C# I get the errors as soon as I touch CHAR or
VARCHAR

Using linked servers gives an even stranger error: only
the first 2 rows are delivered. The two rows are show if I
use C# or Sql Query Analyzer.

So did I miss something in the setup????

regards
Jens Chr

Steven Bras [MS]

unread,
Mar 5, 2002, 12:20:53 PM3/5/02
to
If Oracle has a newer driver for RDB I recommend using it; I assume this
driver is older and not currently maintained, and therefore might not be at
an adequate ODBC compliance level to function properly with ODBC.Net. If
you wish, post the date and version of the driver and I'll do further
research. I would test this possibility, but unfortunately we do not have
an RDB server for this purpose.

William Sampler

unread,
Mar 7, 2002, 3:21:18 PM3/7/02
to
>Which ODBC driver are you using? If you are using
Microsoft's ODBC driver for Oracle, this driver does not
support Oracle RDB. Please advise and I'll continue to
assist if necessary.

I am having the same issue. What driver is need to connect
to Oracle 7.3.4? Also, I can't find any code examples
specific to Oracle. Do you know a spot where there are
some examples?

Thanks for your help,

>.
>

Steven Bras [MS]

unread,
Mar 7, 2002, 6:11:13 PM3/7/02
to
To connect to Oracle 7.3.4, you should use either the Microsoft OLEDB
Provider for Oracle or the Microsoft ODBC Driver for Oracle (or, of course,
Oracle's own OLEDB and ODBC driver for Oracle).

There are many, many code samples for Oracle in our Knowledge Base. Check
it out at http://support.microsoft.com.

0 new messages