How to write the listener.ora and tnsnames.ora
Hi, there
I store my oracle database in the machine A. In the machine B,
it only install the oracle without create database. How should
I write the
listener.ora and tnsnames.ora? So that the machine B could
acces the database which store in the machines A.
Could you give me a simple example and with some description.
Thanks you very much!!
null
wrjih (guest) wrote:
: Hi, there
: I store my oracle database in the machine A. In the machine B,
: it only install the oracle without create database. How should
: I write the
: listener.ora and tnsnames.ora? So that the machine B could
: acces the database which store in the machines A.
: Could you give me a simple example and with some description.
: Thanks you very much!!
1 - you can simply copy the files from the server to the client.
If they are correct, it must work fine
2 - Follow the examples inside the
$ORACLE_HOME/network/admin/samples
3 - Follow my examples:
I will try to make it simple:
The server must have the listener.ora. The client does not need
it if you don't have a database there.
I cannot tell you what is mandatory in the file, and what is not.
The listener.ora has the interface (addr or name)
to listen, the port/proto, and some info about your database
($ORACLE_HOME and Name).
#--- Listener.ora -- my minimal settings ---
LISTENER =
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL= TCP)(Host=Server)(Port= 1521))
(ADDRESS=(PROTOCOL= IPC)(KEY = ORCL))
STARTUP_WAIT_TIME_LISTENER = 1
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = OFF
TRACE_LEVEL_CLIENT=OFF
SID_LIST_LISTENER =
(SID_LIST=(SID_DESC=
(SID_NAME = SACS)
(ORACLE_HOME=/oracle/805)))
#---- end of listener.ora ---
Both machines can, and should have similar TNSNAMES.ORA:
tnsnames.ora has the address or name of the server, and the Name
of the database you wish to connect to.
#--- tnsnames.ora --- minimal.
ORCL = (DESCRIPTION =
(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(Host=Server)(Port =
1521)))
(CONNECT_DATA = (SID = SACS)))
#--- end of tnsnames.ora ---
And finally sqlnet.ora, that is very usefull for setting secure
networks or
just logging for looking for errors. You can also set your
keepalive timeout.
#--- sqlnet.ora
TRACE_LEVEL_CLIENT = OFF
names.directory_path = (TNSNAMES)
SQLNET.EXPIRE_TIME = 10
#-- end of sqlnet.ora --
null
Similar Messages
-
Can any one tell me how to write the properites files and how to acces
can any one tell me how to write the properites files and how to acces thoose files
plz let me no
thanks in advancehttp://www.exampledepot.com/egs/java.util/Props.html
-
How to write the java file and number line where execution point is?
I'd like to log errors encountered by a home made java server to a file.
To be effective, here is how I'd like to build the string to log, roughly :
String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
I doubt so but I'd like to make sure.
Thanksbestam wrote:
I'd like to log errors encountered by a home made java server to a file.
To be effective, here is how I'd like to build the string to log, roughly :
String locError = "ERROR: in "+ filename +" => "+ methodname +", line "+ linenumber +"\n"; Is there a way in java to get such informations? Via reflection?
I doubt so but I'd like to make sure.
ThanksNot quite sure what you mean here. Are you trying to print out the contents of an actual Java error? If so, Throwable.getStackTrace() or Throwable.printStackTrace() are probably what you want.
Winston -
How to flush an instance in the listener.ora file
Hi,
We have Oracle DB server 10.2.0.3.0 running in RHEL4 2.6.9-42. It is a RAC Configured, previously 8 instances. Now we only have seven because we remove the other one; removedserver.company.com
Unfortunately, it was not removed following the correct method because the server was destroyed. We are able to remove it from the list of RAC though using deletenode.sh (in fact it is no longer appearing in +./olsnodes+).
Our problem now is that the instance name is still appearing in our listener.ora file. And I am getting error in alert.log
ORA-00130: invalid listener address '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=+removedserver.company.com+) (PORT=xxxx)))'
If I will edit the listener.ora manually and removed the instance from there, my problem will be
1. it might be added again in the listener.ora when we do adautoconfig
2. I am not sure of the impact if I will do it manually.
Hope somebody would help.
Thanks in advance.SQLNET files, listener.ora and tnsnames.ora must be hand edited by the DBA. Services, too, must be reconfigured by the DBA.
The impact of doing it manually is that it works. <g> -
How to write triggers on startup and shutdown of the server?
Plz advice.
How to write triggers on startup and shutdown of the server?
I could write it but nothing happened!!!Small code example for you:
[email protected]> @ connect mob/mob
[email protected]> create or replace trigger shutdown_trigger
2 before shutdown on database
3 begin
4 insert into shut_table values(sysdate);
5 end;
6 /
Trigger created.
[email protected]> create or replace trigger start_trigger
2 after startup on database
3 begin
4 insert into start_table values(sysdate);
5 end;
6 /
Trigger created.
[email protected]> @ connect "/ as sysdba"
[email protected]> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[email protected]> startup
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 64036368 bytes
Fixed Size 454160 bytes
Variable Size 50331648 bytes
Database Buffers 12582912 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
[email protected]> select * from mob.start_table;
START_DAT
14-SEP-06
[email protected]> select * from mob.shut_table;
SHUT_DATE
14-SEP-06
Best Regards
Krystian Zieja / mob -
How to write the dynamic code for RadioGroupByKey and Check Boxes?
Hi,
Experts,
I have created a WD ABAP application in that i have used RadioGroupByKey and CheckBox Ui elements but i want how to write the dynamic code to that i want to display male and female to RadioGroupByKey and 10 lables to check boxs.
Please pass me some idea on it and send any documents on it .
Thanks in advance ,
Shabeer ahmed.Refer this for check box:
Do check :
bind_checked property is bind to a node with cardinality of 1:1
CHECK_BOX_NODE <---node name
-CHECK_BOX_VALUE <--attribute name of type wdy_boolean
put this code under your WDDOMODIFYVIEW:
DATA:
lr_container TYPE REF TO cl_wd_uielement_container,
lr_checkbox TYPE REF TO cl_wd_checkbox.
get a pointer to the RootUIElementContainer
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_checkbox = cl_wd_checkbox=>new_checkbox(
text = 'WD_Processor'
bind_checked = 'CHECK_BOX_NODE.CHECK_BOX_VALUE'
view = view ).
cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).
lr_container->add_child( lr_checkbox ).
Refer this for Radiobutton :
dynamic radio button in web dynpro abao
Edited by: Saurav Mago on Jul 17, 2009 10:43 PM -
Listener name in the listener.ora file is getting change from GPROD to %s_
Dear Experts,
Please note that after doing the R12.1 upgrade, When i bounce the database i have noted that my database listener name in the listener.ora file is getting change from GPROD to %s_db_listener%. Again every time after changeing the listener log file i am able to start the listener.
Please advise.
[oracle@upgrade 11.2.2]$ lsnrctl start GPROD
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 07-OCT-2011 10:07:33
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /u04/d01/tech_st/11.2.2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener.ora
Log messages written to /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
TNS-01151: Missing listener name, GPROD, in LISTENER.ORA
Listener failed to start. See the error message(s) above...
[oracle@upgrade 11.2.2]$ vi /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
[oracle@upgrade 11.2.2]$ cd network/admin/GPROD_upgrade/
[oracle@upgrade GPROD_upgrade]$ ls
listener_ifile.ora listener.ora listener.ora_bkpaug2911 sqlnet_ifile.ora sqlnet.ora tnsnames.ora
[oracle@upgrade GPROD_upgrade]$ vi listener.ora
(SID_DESC =
(ORACLE_HOME= /u04/d01/tech_st/11.2.2)
(SID_NAME = GPROD)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u04/d01/tech_st/11.2.2)
(PROGRAM = extproc)
STARTUP_WAIT_TIME_%s_db_listener% = 0
CONNECT_TIMEOUT_%s_db_listener% = 10
TRACE_LEVEL_%s_db_listener% = OFF
LOG_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
LOG_FILE_%s_db_listener% = %s_db_listener%
TRACE_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
TRACE_FILE_%s_db_listener% = %s_db_listener%
ADMIN_RESTRICTIONS_%s_db_listener% = OFF
IFILE=/u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener_ifile.oraStep 1- Run the autoconfig on the db tier.
Step -2 Automatically it is changing the setting in the database listener log file and it is showing 4 database listeners are up .
[oracle@upgrade 11.2.2]$ ps -ef |grep inh
oracle 756 1 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 757 756 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 758 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 759 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 1721 31038 0 11:02 pts/2 00:00:00 grep inh
applmgr 31380 1 0 10:53 ? 00:00:00 /u04/d02/apps/tech_st/10.1.2/bin/tnslsnr APPS_GPROD -inherit
Step - 3
Again down the apps tier services.
Step -4
Reset the listener.ora file in the database tier
Please advise.
Regards
Mohammed. -
IPC entries in the listener.ora
My listener.ora looks like the following,
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))
Can I remove the IPC entries in the listener.ora?
Database version is 11.2.0.3 and OS is Sun Solaris1009506 wrote:
My listener.ora looks like the following,
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))
Can I remove the IPC entries in the listener.ora?I give up.
Can you?
FWIW, you can remove the whole listener.ora file & the listener will still start & run without error.
How do I ask a question on the forums?
SQL and PL/SQL FAQ -
How to find the listener port on windows?
Hi Friends,
We have a client who is still using Oracle 8.0.6 on NT 4.0
I have a laptop with oracle client 10g.
I want to connect to the NT database to check it.
How do I know what port does the listener used ? what is the command to run at the c:\ command prompt?
I tried> c:\ lsnrctl stat but the command is not recognized
I tried to find the lsnrctl and bin but there is not.
Please help
Thanks a lotytterp2009 wrote:
Please help.. and please do NOT post [duplicate posts|http://forums.oracle.com/forums/thread.jspa?threadID=935282&tstart=0]
How to find the listener port on windows?The Internet Protocol stack comes with a number of utilities - one of these, called netstat, is very useful to determine which processes are doing what to which IP ports on that platform. Unfortunately, different flavours are implemented. So the Windows one does not support the parameters and output than the Unix/Linux one.
You can use the following on Windows (run it via a command console) to see what processes are listening on what address and port number:
c:\> netstat -n -a -p tcp
-n = display IP addresses and ports in numeric format
-a = list all ports (including ones used for listening
-p tcp = only display protocol entries for TCP An Oracle listener entry should look something as follows:
Proto Local Address Foreign Address State
TCP 0.0.0.0:1521 0.0.0.0:0 LISTENINGSeeing IP +0.0.0.0+ means that the Listener is accepting connections on all your network interfaces - which is standard. The port number is typically 1521. The foreign address is meaningless for a port in listening state.
PS. Why not simply check the listener.ora configuration file? Because what is actually happening may not be what you thought you configured to happen.. -
How to write the expression when create the calculated column?
Dear,
I want to create some calculated column in my attribute view, but I don't know how to write the code in the expression, is there any introduction about this part, how to use those function and how about the grammar in this expression code ? or is there any example about this calculated column?
Thanks for your sincerely answer.Hi Zongjie,
you can find some information about the creation of calculated columns in the HANA Modeling Guide (http://help.sap.com/hana/SAP_HANA_Modeling_Guide_for_SAP_HANA_Studio_en.pdf).
Within chapter 6.2.1 (Create Analytic Views) you can see under point 7 some basics and also a simple example. The same is also valid for Calculation Views.
Chapter 8.9 (Using Functions in Expressions) describes the different available functions.
You also can use the integrated search in the HANA Studio by clicking the "?" button in the button left corner. Then you get some links in the side panel with related information.
In general you can write your expression manually or you can just drag and drop the functions, elements, operators into the editor window. For example if you drag and drop the "if" function into the editor window you get "if(intarg,arg2,arg3)" inserted. The arguments can be replaced manually or also by drag and drop.
It is also worse to use the "Validate Syntax" button on top of the editor window. It gives you directly a feedback if your expression syntax is correct. If not you get some helpful information about the problem (ok, sometimes it is a little bit confusing because of the cryptic error message format ).
Best Regards,
Florian -
How to write the folder path in standard webi report - Most Accessed Documents
How to write the folder path in standard webi report - Most Accessed Documents
All
-> Public Folders
-> Auditor
-> ABCD
I want to give path of folder 'ABCD' and all the reports/ subfolders under it?
Prompt - 'Enter the Folder Path(Add % at the end to include Sub Folders)' ?
Give me exact path syntaxHi Daniel,
But when I give my URL as
http://serverA:80/irj/portal??NavigationTarget=ROLES://portal_content/crm-practice/14-Feb/Test_Page
I am able to access the iview but the thing is I am getting TLN,Toolarea,Masthead,etc.
I will tell my requirement,
ServerA (EP 7.0) has some iviews,pages...
I need to access these iviews from serverB(EP 6.0)....
In ServerB only the iviews has to be displayed in the content area but not TLN,Toolarea,etc.
Kindly help me in this regard.
Thanks and regards,
Purushothaman.
Message was edited by: Purushothaman Vyasarao -
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE except.
und
MESSAGE.....RAISING except.
The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
If the calling program does not handle the exception
· The RAISEstatement terminates the program and switches to debugging mode.
· The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE..... RAISING statement does not display a message. Instead, it fills the system fields sy-msgid, sy-msgty, sy-msgno , and SY-MSGV1 to SY-MSGV4.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
FUNCTION read_spfli_into_table.
""Local Interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
IF sy-subrc NE 0.
MESSAGE e007(at) RAISING not_found.
ENDIF.
ENDFUNCTION.
The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table spfli_tab. If it cannot find any entries, the exception NOT_FOUND is triggered with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Calling READ_SPFLI_INTO_TABLE
The following program calls the function module READ_SPFLI_INTO_TABLE:
REPORT demo_mod_tech_fb_read_spfli.
PARAMETERS carrier TYPE s_carr_id.
DATA: jtab TYPE spfli_tab,
wa LIKE LINE OF jtab.
CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
EXPORTING
id = carrier
IMPORTING
itab = jtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
WHEN 2.
MESSAGE e702(at).
ENDCASE.
LOOP AT jtab INTO wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDLOOP.
The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
Or
just have to decide what exceptions u want and under what conditions.
then declarethese exeptions under the exceptions tab.
in the source code of ur function module.
if
like this u can code .
now when u call the function module in tme mainprogram.
if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
in the fm u can program these sy-subrc values and trigger the code for ur exception.
Please reward if useful
Regards,
Ravi
Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM -
How to track the login time and logout times of clients
hai
please give me the solution
suppose there are 5 systems connected in LAN.
how to track the login time and logout times of clients
for a given time(may be one day or 1 hour) using any programming language.
please give me the solutionWhen the client logs in you write the client's ID and the current time to a database. Likewise when the client logs out. Assuming of course that you have a program that knows when those events occur.
-
How to write the nodevalue back to xml file?
Hi, Everybody:
These are two packages I used. javax.xml.parsers.*,org.w3c.dom.*
Now I use "setNodeValue("abc") to set the node value to "abc". But it is not really saved back into XML file. It only change the node value in memory.
How to write the changes back to XML file? Thank you very much for your help.
Michelle* Version : 1.00
* File Purpose : Given the xml file loads into dom and recreate the file with the updated values.
* Developer : Kashif Qasim : 25/july/04
* Modify detail :
import java.lang.*;
import java.io.*;
import java.util.*;
import java.text.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.*;
public class XMLWriter
private String displayStrings[] = new String[5000];
private int numberDisplayLines = 0;
private Document document;
//private final Node c;
public synchronized void displayDocument(String uri,Vector UpdatedValues,String getTaskID)
try {
DOMParser parser = new DOMParser();
parser.parse(uri);
document = parser.getDocument();
display(document, "",UpdatedValues);
} catch (Exception e) {
e.printStackTrace(System.err);
ReadXmlConfig objReadXmlConfig = null;
FileWriter filewriter = null;
try {
filewriter = new FileWriter(uri);
for(int loopIndex = 0; loopIndex < numberDisplayLines; loopIndex++){
filewriter.write(displayStrings[loopIndex].toCharArray());
//System.out.println("displayStrings[loopIndex].toCharArray() "+displayStrings[loopIndex].toString());
//filewriter.write("\n");
filewriter.close();
System.gc();
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSLog("File updated for "+getTaskID+" succesfully, file is closed now ");
} catch (IOException e) {
System.err.println("Caught IOException: " + e.getMessage());
objReadXmlConfig = new ReadXmlConfig();
objReadXmlConfig.ITSErrorLog("File updated FAILED for "+getTaskID+". Reason for file error "+e.toString());
}finally {
if (filewriter != null) {
System.out.println("Closing File");
objReadXmlConfig =null;
try{
filewriter.close();
}catch(IOException e){
System.err.println("Caught IOException: " + e.getMessage());
} else {
System.out.println("File not open");
private void display(Node node, String indent, Vector UpdtRecs)
if (node == null) {
return;
int type = node.getNodeType();
NodeList nodeList = document.getElementsByTagName("QueryParm");
int TotalRecs = UpdtRecs.size();
switch (type) {
case Node.DOCUMENT_NODE: {
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] +=
"<?xml version=\"1.0\" encoding=\""+
"UTF-8" + "\"?>";
numberDisplayLines++;
displayStrings[numberDisplayLines] += "\n";
display(((Document)node).getDocumentElement(), "",UpdtRecs);
break;
case Node.ELEMENT_NODE: {
if(node.getNodeName().equals("QueryParm")) {
for(int i =0 ; i< nodeList.getLength() ; i++)
Node nodeQry = nodeList.item(i);
NamedNodeMap nnp = nodeQry.getAttributes();
for(int j= 0 ; j < nnp.getLength() ; j++)
Attr atr = (Attr) nnp.item(j);
if(atr.getName().equalsIgnoreCase("value_"+(i+1)))
//System.out.println(atr.getName() +" : " + atr.getNodeValue() );
atr.setNodeValue(UpdtRecs.get(i).toString());
displayStrings[numberDisplayLines] = indent;
displayStrings[numberDisplayLines] += "<";
displayStrings[numberDisplayLines] += node.getNodeName();
int length = (node.getAttributes() != null) ?
node.getAttributes().getLength() : 0;
Attr attributes[] = new Attr[length];
for (int loopIndex = 0; loopIndex < length; loopIndex++) {
attributes[loopIndex] = (Attr)node.getAttributes().item(loopIndex);
for (int loopIndex = 0; loopIndex < attributes.length; loopIndex++) {
Attr attribute = attributes[loopIndex];
displayStrings[numberDisplayLines] += " ";
displayStrings[numberDisplayLines] += attribute.getNodeName();
displayStrings[numberDisplayLines] += "=\"";
displayStrings[numberDisplayLines] += attribute.getNodeValue();
displayStrings[numberDisplayLines] += "\"";
displayStrings[numberDisplayLines]+=">";
numberDisplayLines++;
NodeList childNodes = node.getChildNodes();
if (childNodes != null) {
length = childNodes.getLength();
indent += " ";
for (int loopIndex = 0; loopIndex < length; loopIndex++ ) {
display(childNodes.item(loopIndex), indent,UpdtRecs);
break;
case Node.CDATA_SECTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<![CDATA[";
displayStrings[numberDisplayLines] += node.getNodeValue();
displayStrings[numberDisplayLines] += "]]>";
numberDisplayLines++;
break;
case Node.TEXT_NODE: {
displayStrings[numberDisplayLines] = "";
String newText = node.getNodeValue().trim();
if(newText.indexOf("\n") < 0 && newText.length() > 0) {
displayStrings[numberDisplayLines] += newText;
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
case Node.PROCESSING_INSTRUCTION_NODE: {
displayStrings[numberDisplayLines] = "";
displayStrings[numberDisplayLines] += "<?";
displayStrings[numberDisplayLines] += node.getNodeName();
String text = node.getNodeValue();
if (text != null && text.length() > 0) {
displayStrings[numberDisplayLines] += text;
displayStrings[numberDisplayLines] += "?>";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
break;
if (type == Node.ELEMENT_NODE) {
displayStrings[numberDisplayLines] = indent.substring(0,
indent.length() - 4);
displayStrings[numberDisplayLines] += "</";
displayStrings[numberDisplayLines] += node.getNodeName();
displayStrings[numberDisplayLines] += ">";
displayStrings[numberDisplayLines] += "\n";
numberDisplayLines++;
indent += " ";
public static void main(String args[])
Vector xmlValue = new Vector();
xmlValue.add(0,"Kashif");
xmlValue.add(1,"Qasim");
//displayDocument("NewMediation.xml",xmlValue);
<?xml version="1.0" encoding="UTF-8"?>
<Mediation>
<Task1>
<Source>
<SourceDriver>com.microsoft.jdbc.sqlserver.SQLServerDriver</SourceDriver>
<SourceConnection>jdbc:microsoft:sqlserver://10.2.1.58:1433;DatabaseName=MTCVB_HDS;</SourceConnection>
<SourceUser>sa</SourceUser>
<SourcePassword>sa</SourcePassword>
<Table>
<SourceTable>t_Agent</SourceTable>
<SourceQuery><![CDATA[SELECT SkillTargetID,PersonID,PeripheralID,EnterpriseName,PeripheralNumber,Deleted,TemporaryAgent,AgentStateTrace,ChangeStamp FROM t_Agent where SkillTargetID > {value_1} order by SkillTargetID]]>
</SourceQuery>
<SourceParm BusinessRule="" ColumnName="SKILLTARGETID" ColumnNumber="1" DataType="Numeric" DefaultValue="0" Format="mm/dd/yyyy xx:xx:xx XX">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERSONID" ColumnNumber="2" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALID" ColumnNumber="3" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="ENTERPRISENAME" ColumnNumber="4" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="PERIPHERALNUMBER" ColumnNumber="5" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="DELETED" ColumnNumber="6" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="TEMPORARYAGENT" ColumnNumber="7" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="AGENTSTATETRACE" ColumnNumber="8" DataType="String" DefaultValue="" Format="">
</SourceParm>
<SourceParm BusinessRule="" ColumnName="CHANGESTAMP" ColumnNumber="9" DataType="String" DefaultValue="" Format="">
</SourceParm>
<QueryParm FldName_1="SkillTargetID" FldType_1="Number" value_1="0">
</QueryParm>
</Table>
</Source>
</Task1>
</Mediation>
The QueryParm values are updated thru this code :)
Hope it helps u ... -
How to write the JTables Content into the CSV File.
Hi Friends
I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
I just add the Code which Used to write the Database records into the CSV Files.
void exportApi()throws Exception
try
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
System.out.println("Connected");
stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
rsexport=stexport.executeQuery("Select * from IssuedBook ");
ResultSetMetaData md = rsexport.getMetaData();
int columns = md.getColumnCount();
String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
//write fields names
String rec = "";
for (int i=0; i < fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rsexport.beforeFirst();
while(rsexport.next())
rec = "";
for (int i=1; i < (columns+1); i++)
try
rec +="\""+rsexport.getString(i)+"\",";
rec +="\""+rsexport.getInt(i)+"\",";
catch(SQLException sqle)
// I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
}With this Same code how to Write the JTable content into the CSV Files.
Please tell me how to implement this.
Thank you for your Service
JofinHi Friends
I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.*;
public class Exporting extends JDialog implements ActionListener
private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
private ButtonGroup bg;
private JPanel exportpanel;
private JButton btnExpots;
FileReader reading=null;
FileWriter writing=null;
JTable table;
JScrollPane scroll;
public Exporting()throws Exception
setSize(550,450);
setTitle("Export Results");
this.setLocation(100,100);
String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
{"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0203","PHP DEVELOPMENT","SUNITHA","123"},
{"B0204","PRIAM","SELVI","1354"},
{"B0205","JAVA PROGRAMING","JAMES","1234.00"},
{"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
{"B0207","PHP DEVELOPMENT","SUNITHA","123"},
{"B0208","PRIAM","SELVI","1354"}};
btnExpots= new JButton("Export");
btnExpots.addActionListener(this);
btnExpots.setBounds(140,200,60,25);
table = new JTable();
scroll=new JScrollPane(table);
((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
System.out.println(table.getModel());
exportpanel= new JPanel();
exportpanel.add(btnExpots,BorderLayout.SOUTH);
exportpanel.add(scroll);
getContentPane().add(exportpanel);
setVisible(true);
public void actionPerformed(ActionEvent ae)
Object obj=ae.getSource();
try {
PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
if(obj==btnExpots)
for(int row=0;row<table.getRowCount();++row)
for(int col=0;col<table.getColumnCount();++col)
Object ob=table.getValueAt(row,col);
//exportApi(ob);
System.out.println(ob);
System.out.println("Connected");
String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
String rec = "";
for (int i=0; i <fieldNames.length; i++)
rec +='\"'+fieldNames[i]+'\"';
rec+=",";
if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
writing.println(rec);
//write values from result set to file
rec +="\""+ob+"\",";
if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
writing.println(rec);
writing.close();
catch(Exception ex)
ex.printStackTrace();
public static void main(String arg[]) throws Exception
Exporting ex= new Exporting();
}Could anyone Please modify my code and help me out.
Thank you for your service
Cheers
Jofin
Maybe you are looking for
-
Windows 7 ultimate edition, Dell Studio XPS PC. I used Norton utilities, and store all my logons and passwords int he identity safe. With Foxfire 10, my identity safe has disappeared. I tried the routine of forcing add-ons to work and it still doesn'
-
Cannot create billing document from sales document
Hi, i am trying to create billing document from the created sales document. But the billing document is not generated. I was getting the error - ' Document is blocked from billing'. SO, i changed the billing block and left it blank, and when I trie
-
Sony Vaio Laptop Won't Turn On
I have a Sony Vaio laptop that turns off every time I turn it on. I have taken it in for repairs and they can't that nothing is wrong with it and they can turn it on. They even run diagnostics and have opened it up and can't find a problem. I did upd
-
T400 screen blinks, goes black, then returns
Hi & hope someone can give some guidance. I have a T400, Win7Pro 32bit that has been acting strange. It is a problem that I sent it back for right after I got it, but now am out of warranty. While using it (not at start up, usually has been running f
-
CUCM Licensing/ordering and demo licenses
Hello, I am trying to setup a lab with CUCM and trying to figure out the process to place an order for CUCM. I know that you need DLU licneses for each phone, however do I need to buy a base license in addition to that? How does it work? Also, does C