I am trying ServiceStack OrmLite (with Oracle database). But it just hangs at db.Select.. it is not throwing exception either.. it just hangs there as if there are too many data to load.
I have installed the latest oracle instant client ver 12.1 in my PC.
This is my OrmLite code:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args) {
string DbConnection =
"SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xxx.xxx.xxx)(PORT=9530))(CONNECT_DATA=(SERVICE_NAME=MYSID)));uid=myusername;pwd=mypassword";
var dbFactory = new OrmLiteConnectionFactory(
DbConnection, false, OracleDialect.Provider);
using (var db = dbFactory.Open()) {
var res = db.Select<Einduk>().Take(10); //<-- it hangs here, no stacktrace whatsoever
foreach (var einduk in res) {
Console.WriteLine(einduk.ToString());
}
}
Console.ReadLine();
}
}
}
And this is my model class:
namespace ConsoleApplication1
{
public class Einduk
{
[PrimaryKey]
public string Akaun { get; set; }
public string Jenis { get; set; }
public string Bakaun { get; set; }
public string Oldac { get; set; }
public string Plgid { get; set; }
public string Pnama { get; set; }
public string Almat { get; set; }
public string Kslah { get; set; }
public DateTime? Trikh { get; set; }
public decimal? Amaun { get; set; }
public override string ToString() {
return string.Format("Jenis: {0}, Akaun: {1}, Bakaun: {2}, Oldac: {3}, Plgid: {4}, Pnama: {5}, Almat: {6}, Kslah: {7}, Trikh: {8}, Amaun: {9}", Jenis, Akaun, Bakaun, Oldac, Plgid, Pnama, Almat, Kslah, Trikh, Amaun);
}
}
}
This is my table, note that the table does not have a primary key. But in my model I set Akaun as the primary key as I know it is unique. Will this cause the problem?
CREATE TABLE "EINDUK"
(
"JENIS" CHAR(1 BYTE),
"AKAUN" VARCHAR2(40 BYTE),
"BAKAUN" VARCHAR2(50 BYTE),
"OLDAC" VARCHAR2(20 BYTE),
"PLGID" VARCHAR2(15 BYTE),
"PNAMA" VARCHAR2(100 BYTE),
"ALMAT" VARCHAR2(282 BYTE),
"KSLAH" VARCHAR2(508 BYTE),
"TRIKH" DATE,
"AMAUN" NUMBER
)
.Take()... hmm... any clue how to limit the number of rows returned? - Rosdi Kasimdb.select<Einduk>("rownum < 10")instead of.Take()- Rosdi Kasim