Saturday, September 20, 2008

TNS Error ORA 12154

There are many ways that this error could occur, I would like to get into few of them to the best of my knowledge and how this ORA-12154: TNS can be resolved.

I was worried many times while I was trying to connect to a oracle data base server with this error.

For the first time when you install oracle10g client software select Administrator, so that you can configure your local machine to a remote data base server through configuration management tool provided iff you install administrator.

Once you have configured to a data base, you can find it in a text file (tnsnames.ora) located at oracle installation path sub directory network\admin.


Ex :-
DPG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbdev)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = dpg)
)
)



DPG Database service name you configure
dbdevOracle data base server name
SIDData base name on server

Once it is configured, you can connect to this data base with any user name created to this data base. Funny thing is, I still observed TNS Error while doing all the above steps. I created a new application (.NET) and used oracleclient.dll to connect to this configured data base.Shocking is I am able to connect to this configured data base from other application but not with this new application. I believe this step surely avoids the error you get. Observe the path where application is, if there is any folder that contains ‘(‘or ‘)’ in folder name or path with ‘(‘or ‘)’ in it then definitely you will get this TNS error even if you are configured. The new application which is throwing TNS Error is because I saved this application in path having ‘)’ and ‘(‘. Hope this helps you :).

4 comments:

Chandra Shekhar said...

how to retrieve id of controls placed in itemtemplate of a datalist


for example: if we place 2 buttons in item template.

if we click 1 button then other button in the same record has to be disabled

Programming and Database Concepts said...

What ever components we are using
(button,textbox,label,checkbox etc..) that are placed inside a edititemtemplate or itemtemplate
can be identified from "Rowdatabound" event of that specific gridview.
ex:-
code :
protected void gvwDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList drp = e.row.FindControl("drplist") as DropDownList;
}

design :
In design you can define a component (dropdown list) in item or edit item template whose id is 'drplist'.

But the example what you have said is you want to handle onclick event of a button to disable another button.
suppose btn1 click should disable btn2.
You can handle this using javascript.
same as above as i said in data bound event
if(e.row.findcontorl("btn1")!=null && e.row.findcontorl("btn2")!=null)
{
button bt1=e.row.findcontrol("btn1") as button;
button bt2=e.row.findcontrol("btn2") as button;
bt1.attributes.add("onclick","document.getElementById('"+bt2.ClientID+"').disable=true;");
}

provided these buttons should be defined in item template.

Hope this helps u
cheers

Anonymous said...

Hi this is VaraPrasad from SCET in CSE 2006 batch as i have two doubts in .Net bhanoji said that u will be clarifying doubts in .net.
My doubt in .net is.
a)how to use resources files in .net using resource manager
and
b)how to write skins in rads controls

Programming and Database Concepts said...

Hi Vara prasad,
How are you doing?
Please find the below link, I have updated inmy blog regarding skins for RAD controls.
http://programmerfindings.blogspot.com/2008/09/how-to-apply-skins-for-rad-controls-in.html

I shall provide you comments or updates regarding Globalisation in a short span.
i can update it now, but shall explain you with some source code.
Cheers,
Take care,
Srinivas