oracle not generating table classes

51 views
Skip to first unread message

Justin

unread,
Oct 21, 2010, 2:35:38 PM10/21/10
to DbLinq
All,

I am using this syntax to generate a .cs file for my oracle schema but
no tables are being generated. Am I missing something?

c:\dblinq\dbmetal --
conn="Server=my_server;Uid=my_server;Pwd=my_password" --
database=my_database --provider=Oracle --code="c:\dblinq\linq.cs"

the linq.cs file is generated, but no tables are in it at all.

Here is what is generated in the linq.cs file...

//
// ____ _ __ __ _ _
// | _ \| |__ | \/ | ___| |_ __ _| |
// | | | | '_ \| |\/| |/ _ \ __/ _` | |
// | |_| | |_) | | | | __/ || (_| | |
// |____/|_.__/|_| |_|\___|\__\__,_|_|
//
// Auto-generated from my_database on 2010-10-21 13:55:07Z.
// Please visit http://code.google.com/p/dblinq2007/ for more
information.
//
using System;
using System.ComponentModel;
using System.Data;
#if MONO_STRICT
using System.Data.Linq;
#else // MONO_STRICT
using DbLinq.Data.Linq;
using DbLinq.Vendor;
#endif // MONO_STRICT
using System.Data.Linq.Mapping;
using System.Diagnostics;


public partial class my_database : DataContext
{

#region Extensibility Method Declarations
partial void OnCreated();
#endregion


public my_database(string connectionString) :
base(connectionString)
{
this.OnCreated();
}

public my_database(string connection, MappingSource mappingSource) :
base(connection, mappingSource)
{
this.OnCreated();
}

public my_database(IDbConnection connection, MappingSource
mappingSource) :
base(connection, mappingSource)
{
this.OnCreated();
}
}

#region Start MONO_STRICT
#if MONO_STRICT

public partial class my_database
{

public my_database(IDbConnection connection) :
base(connection)
{
this.OnCreated();
}
}
#region End MONO_STRICT
#endregion
#else // MONO_STRICT

public partial class my_database
{

public my_database(IDbConnection connection) :
base(connection, new DbLinq.Oracle.OracleVendor())
{
this.OnCreated();
}

public my_database(IDbConnection connection, IVendor sqlDialect) :
base(connection, sqlDialect)
{
this.OnCreated();
}

public my_database(IDbConnection connection, MappingSource
mappingSource, IVendor sqlDialect) :
base(connection, mappingSource, sqlDialect)
{
this.OnCreated();
}
}
#region End Not MONO_STRICT
#endregion
#endif // MONO_STRICT
#endregion

Justin

unread,
Oct 22, 2010, 9:06:03 AM10/22/10
to DbLinq
All,

It appears that my connection string to oracle requires a service_name
or sid. When I try to use it in my connection string via dbmetal I get
the following error from dbmetal:

dbmetal - keyword sid not supported

or...

dbmetal - keyword service_name not supported

my connection string I am passing to dbmetal looks like this:

c:\dblinq\dbmetal --
conn="Server=my_server;sid=my_service_name;Uid=my_username;Pwd=my_password"
--database=my_database --provider=Oracle --code="c:\dblinq\linq.cs"

How can I get dbmetal to accept a sid or service name parameter in the
connection string?

Thanks!

/Justin

Justin

unread,
Oct 24, 2010, 1:27:37 AM10/24/10
to DbLinq
All,

I found the fix for this problem so wanted to post it in case others
may come across it.

I am running an oracle 11G database on a unix box. I am trying to use
dblinq on a local pc running windows 7. That is my setup. I have the
oracle 11G client installed on my local pc. Here is the syntax I had
to use in order to go across the network to my oracle 11g database on
the unix server:

c:\dblinq\dbmetal --
conn="Server=name_in_my_local_tns_names_ora_file;Uid=my_user_name;Pwd=my_password"
--database=my_database --provider=Oracle --code="c:\dblinq\linq.cs"

Then I added the linq.cs file to my project, set a reference to
dblinq.dll, system.data.linq.dll, and DbLinq.Oracle.dll and it worked
fine.

I came across one more error that someone may find helpful. As I ran
dbmetal against the database, I recieved this error:

DbMetal: Don't know how to convert the SQL type 'undefined' into a
managed type.

Parameter name: dataType

My fix... Oracle sometimes will not compile/resolve a view unless u
use it.   there was a view in my database where all was not resolved,
because it was imported & not created in the database. I just brought
it up in toad & I could see undefined fields that got resolved. After
this, dblinq worked fine against the database.

/Justin
Reply all
Reply to author
Forward
0 new messages