These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Oracle Connection error : Oracle 8i
PostPosted: Mon Aug 13, 2007 11:48 am 
Newbie

Joined: Sun Aug 12, 2007 12:45 pm
Posts: 1
Hello:
I get the following error while updating an element using NHibernate.

Unhandled Exception: NHibernate.ADOException: could not update: [TestHibernate.U
pdateISCM#164][SQL: UPDATE P_SSDB_DEPT SET VALUE = ? WHERE DEPT_ID = ?] ---> System.Data.OracleClient.OracleException: ORA-12571: TNS:packet writer failure

Mapping class:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="TestHibernate.UpdateISCM, TestHibernate"
table="P_SSDB_DEPT">
<id name="Id" column="DEPT_ID" type="String" length="10">
<generator class="assigned"/>
</id>
<property name="StatusFlag"
column="VALUE"
type="String"
length="128"/>
</class>
</hibernate-mapping>

Object Class file

using System;
using System.Collections.Generic;
using System.Text;

namespace TestHibernate
{
public class UpdateISCM
{
private string statusFlag;
private string id;

public UpdateISCM()
{

}

public virtual string Id
{
get { return id; }
set { id = value; }
}

public virtual string StatusFlag
{
get { return statusFlag; }
set { statusFlag = value; }
}
}
}

Test class

Configuration config = new Configuration();

config.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.OracleDialect");
config.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleClientDriver");
config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, "Data Source=source;User ID=abc;Password=abc;Unicode=True");

config.AddAssembly("TestHibernate");

ISessionFactory factory = config.BuildSessionFactory();
ISession session = factory.OpenSession();
//ITransaction transaction = session.BeginTransaction();

UpdateISCM joeCool = new UpdateISCM();
joeCool.Id = "164";
joeCool.StatusFlag ="Changed";
session.Update(joeCool);
session.Flush();
//transaction.Commit();
session.Close();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 11:56 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
I don't know Oracle (anyone?) but just to help get things started for you: to what type of query problem might a "packet writer failure" refer?

Also, this is a really confusing use pattern of NH. Presumably, you already saved UpdateISCM["164"], and now you are updating it by building a whole new object with the same ID and calling Update()? Interesting, in that it saves you a read, but not something I've seen before.


Top
 Profile  
 
 Post subject: Re: Oracle Connection error : Oracle 8i
PostPosted: Mon Jun 08, 2009 4:45 pm 
Newbie

Joined: Mon Jun 08, 2009 4:30 pm
Posts: 1
I know this is three years old (ish), but I think I know the answer to the problem here. Given that it hasnt been posted here, I thought it may help others who get this problem.

Its down to the connection string. This version of Oracle, at least, has a fairly funky connection string if you are not using TNS. You can get the connection string from www.connectionstrings.com for both types of connection.

I hope replying to such an old post doesnt annoy anyone..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.