Saving a script as .sql results in .pls file
I wrote a SQL statement in Raptor which I saved as .sql file.
The generated file has a .pls suffix instead of the .sql suffix.
This is a bug. number 4926221
Similar Messages
-
Unix script output sql result to terminal
Hi,
I run the script below within a unix script. the query runs but only outputs the first line. I need the whole results output to the terminal.. please let me know if I am doing something wrong. thanks
ORACLE_SID=orcl
export ORACLE_SID
SHELL=/bin/sh
db="username/password"
sqlplus -s $db <<xxx
set serveroutput on
define yy=100
whenever sqlerror exit yy
begin
declare
Dyn_table_name VARCHAR2(100);
Dyn_query_string VARCHAR2(4000);
Type csr_dyn IS REF CURSOR;
csr_dyn1 csr_dyn;
col1 varchar2(200);
col2 varchar2(200);
col3 varchar2(200);
col4 varchar2(200);
col5 varchar2(200);
begin
Dyn_table_name :='''my_table''';
Dyn_query_string :='SELECT b.session_id ,s.serial#,NVL(b.oracle_username,''(oracle)'') AS username,'
||'a.object_name,b.os_user_name FROM dba_objects a,v\$locked_object b,v\$session s'
||' WHERE a.object_id =Upper(b.object_id)and b.session_id=s.sid and a.object_name='||Dyn_table_name;
/*dbms_output.put_line(Dyn_query_string);*/
dbms_output.put_line('SID'||' '|| 'serial#' || ' '||'USERNAME'||' '||'OBJECT_NAME'||' '||'OS_USER_NAME');
dbms_output.put_line('------------------------------------------------------------------------------------');
OPEN csr_dyn1 FOR dyn_query_string;
LOOP
FETCH csr_dyn1 INTO col1,col2,col3,col4,col5;
EXIT WHEN csr_dyn1%NOTFOUND;
dbms_output.put_line(col1||' '|| col2||' '|| col3 || ' ' || col4 ||' '|| col5);
END LOOP;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(to_char(sqlcode)|| ' '|| sqlerrm);
end;
end;
set serveroutput off
exit
xxxSorry all your suggestion did not work ( the log file had this error message
Usage 1: sqlplus -H | -V
-H Displays the SQL*Plus version and the
usage help.
-V Displays the SQL*Plus version.
Usage 2: sqlplus [ [<option>] [<logon>] [<start>] ]
<option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]
... I know its possible to login into sqlplus and run the querry, but I want it as a script which would output this kind of result to the screen
SESSION_ID SERIAL# USERNAME OBJECT_NAME OS_USER_NAME
251 30330 PRD my table oracle
335 11624 PRD my table oracle
469 2592 PRD my table oracle
849 8619 PRD my table oracle
934 40211 PRD my table oracle
955 15043 PRD my table oracle
is it possible or am I asking for the impossible...!!! I appreciate your suggestion... you can alter the script I put up and paste the correction so that I can see cleary how you made it work for you. -
How to combine 3 PowerShell scripts to write results to CSV file?
Hello,
I have 3 domains, and I like to combine the results from the Get-ADUser and write the results into one CSV file. Can this be done? How to do this? Below are the 3 Get-ADUser
scripts:
Get-ADUser -Filter {enabled -eq "true" -and title -like "*"} -SearchBase "DC=domain1, DC=com" -Properties hiredate, department, surname, displayname export-csv "d:\scripts\pbtfusers.csv"
Get-ADUser -Filter {enabled -eq "true" -and title -like "*"} -SearchBase "DC=domain2, DC=com" -Properties hiredate, department, surname, displayname export-csv
"d:\scripts\pbtfusers.csv"
Get-ADUser -Filter {enabled -eq "true" -and title -like "*"} -SearchBase "DC=domain3, DC=com" -Properties hiredate, department, surname, displayname export-csv
"d:\scripts\pbtfusers.csv"
PaulSure:
Get-ADUser tester1 | Export-Csv .\userOutput.csv
Get-ADUser tester2 | Export-Csv .\userOutput.csv -Append
Get-ADUser tester3 | Export-Csv .\userOutput.csv -Append
Sample output:
PS C:\Scripts\PowerShell Scripts\Misc Testing\9-3-2014> Import-Csv .\userOutput.csv | Select Name
Name
tester1
tester2
tester3
This is an extremely simplified example. It returns three user objects and writes them all to the output file one at a time.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
Saving TIFF with LZW compression results in larger file size.
I know this never used to be the case with previous versions of Photoshop, but since I upgraded to CS5.1, when I save files with LZW compression checked, the resultant file size is higher than if I uncheck the box.
For example one file with LZW compression is 56.3MB, and without it is 47.8mb
Is it just me, or have Adobe got their code mixed up?
Edit: This appears to only affect 16-bit images, with 8-bit images, LZW works as expected.
Message was edited by: Toundy. Added info about 16-bit images.From the above link:
Before you Post:
Firstly - have you really checked the 'help' option in the program? Many problems can be solved far faster by getting the answer from the Help File.
Secondly - check the Forum FAQ folder. There's advice there on many common questions and problems.
Thirdly - use the 'Knowledgebase Search' option near the top of this page. Or you can click here to go to the relevant page and enter your search words there - or just search for 'Photoshop' there to see summaries of all the relevant items.
Fourthly, try searching this forum. It may well be your question has already been asked and answered.The archives are full of useful advice. Please remember to perform a search to see if your question has previously been answered. You can click here to search the Photoshop-for-Macintosh forum.
Lastly, Check whether you are entitled to Adobe technical support - click here for a summary of support options.
If you can't find the answer by any of those methods, do post your question in the relevant forum here. -
Cannot compile SQL Developer generated pls file
I right click on a package and choose 'Save Package Spec and Body...', then I open the file to edit it.
When I try to compile the package I get the following error... in both version 2.1 and 3.0
Error(93,1): PLS-00103: Encountered the symbol "/"
Very frustrating that the tool will not compile a file it created...You're right.
This save as one option was a request, but support for such file wasn't added (at least yet). Save your specs and bodies in separate files (File - Save As).
Have fun,
K. -
Pls give some shell scripting for sql/plsql
pls give some shell scripting for sql/plsql
794244 wrote:
pls give some shell scripting for sql/plsqlNeither SQL or PL/SQL are shell script languages. Both are server side languages that executes inside an Oracle database server process.
This is an important concept to understand when using SQL*Plus for example to "script" interaction with an Oracle database. -
How to save SQL result to file in forms 10g
Hi All,
I am using Oracle/forms 10g and need to create a file from a predefined sql statement .
Just wondering if there is a build-in provided by oracle to export sql result to a file from Forms?.
Your quick response will be of great help.
Thanks
AalishanAalishan,
I guess it all depends on where you need to create the output file. You can use the database package UTL_FILE to write a file to the database server file system or you can use the Forms TEXT_IO built-in to write to the client file system. Is your intent to export the data in a multi-line block to a file? If so, TEXT_IO is what you want to use. The Forms help system has all the information and a few examples you will need to get started.
Hope this helps.
Craig... -
Saving SQL result set in new table
Is it possible to save a SQL result set in a new table? (easily)
What I want to do is duplicate, or back up a table.Create table temp as (select a,b,c from your_table); This statement will create a table with your resultset. This will work in Oracle, I am not sure about others.
-
Hi,
I have a sql*developer version 1.5 but i am getting a problem while saving query result to a file. When i click on "script output "-> "file icon" nothing is showing.
Can anyboby guide me whether its a bug or some other settings are required.
I have oracle 10.2.0.3 working on linux.
Thanks & regards
GirishI am getting the same thing and as far as I know it is a bug.
As a workaround, you can either copy the contents of the script output or run the query as a statement (F9) instead of as a script (F5) and export the query results from the results tab. -
How to join two pl/sql tables .,.,,Urgent pls help
Hi,
Please tell me how to join to pl/sql tables with example
thanks
aspIf your main intention is to get the common records/or getting whole records from the 2 different pl/sql arrays then , pls check this piece of code & explanation
The SQL language has long offered the ability to apply set operations (UNION, INTERSECT, and MINUS) to the result sets of queries. In Oracle Database 10g, you can now use those same high-level, very powerful operators against nested tables (and only nested tables) in your PL/SQL programs and on nested tables declared as columns inside relational tables.
Let's take a look at some of the syntax needed to do this, starting with UNION.
First, I create a schema-level nested table type:
CREATE OR REPLACE TYPE strings_nt
IS TABLE OF VARCHAR2(100);
Then I define a package and within it create and populate two nested tables of this type, each containing some of my father's and my favorite things:
CREATE OR REPLACE PACKAGE favorites_pkg
IS
my_favorites strings_nt
:= strings_nt ('CHOCOLATE'
, 'BRUSSEL SPROUTS'
, 'SPIDER ROLL'
dad_favorites strings_nt
:= strings_nt ('PICKLED HERRING
, 'POTATOES'
, 'PASTRAMI'
, 'CHOCOLATE'
PROCEDURE show_favorites (
title_in IN VARCHAR2
, favs_in IN strings_nt
END;
In this package, I also include a procedure to show the contents of a strings_nt nested table. This will come in very handy shortly.
By defining these collections in a package, outside any program, they persist (they maintain their state and values) for the duration of my session or until I change or delete them. This means that I can now write programs outside the package to manipulate the contents of those collections.
Note that this package has been simplified for the purposes of presenting collection functionality. In a production application, you should always take care to "hide" your package data, as with these collections, in the package body, and then provide procedures and functions to manage the data.
Suppose, for example, that I would like to combine these two collections into a single collection of our favorites. Prior to Oracle Database 10g, I would have to write a loop that transfers the contents of one collection to another. Now, I can rely on the MULTISET UNION operator, as shown below:
DECLARE
our_favorites
strings_nt := strings_nt ();
BEGIN
our_favorites :=
favorites_pkg.my_favorites
MULTISET UNION ---- Use INTERSECT , if you want to know common records
favorites_pkg.dad_favorites;
favorites_pkg.show_favorites (
'ME then DAD', our_favorites);
END;
The output from this script is:
ME then DAD
1 = CHOCOLATE
2 = BRUSSEL SPROUTS
3 = SPIDER ROLL
4 = PICKLED HERRING
5 = POTATOES
6 = PASTRAMI
7 = CHOCOLATE
------------------------------ -
Saving query results to text file
Hi experts,
I would like to save a query results to text file.
The query has desined to the correct structure and I wish the query results will be saved automaticly to text file every time the query is running.
The query should cintain some sql code that will save the query to text file instead of show the query results.
What function of SQL should I add to query to achieve that goal. (The query is a long one).
Thanks in advance,
JosephIf you are talking about Query Manager, it is not difficult to do. No matter how long your query coding is, just go to the start point of your query. Then press CtrlShiftEnd to select all the TEXTs. CtrlC and CtrlV will copy the text (query codes) to text file easily.
Thanks,
Gordon -
Using Sql Result and Limit Value in Prompt OBIEE 11.1.1.5
Dear Gurus,
I have prompt hierarchy like this:
Year
Quarter
Month
Which are using limit value (Quarter depend on Year, Month depend on Quarter), but I have issue because appear null also in those prompt
I have checked my database, view, repository there are not null.
My questions is, how to remove null in prompt when sql result can't use together with limit value, I don't know how to remove it using column filter.
NB:I already using presentation variable in sql result in order to remove null and using constraint, but it show nothing in prompt view unless we press apply button.
So I don't use this
Please help, kindly appreciated
JOE
Edited by: JoeSSI on Mar 27, 2012 2:03 AMHi,
Can you edit your prompt here you can find show option then select SQL Result please modify statement like below.
SELECT your column name FROM subject area where your column name is not null
Go--> Edit your prompt--> Show--> Select Sql result---> change statement like above.
Second way.
Go to physical layer then double click your column name here you can find *"nullable"* option please check that.
Go--> Physical Layer--> Extract table --> select your column name-->double click your column name--> here you can find option like Nullable please check it.
Award points it is useful.
Thanks,
Satya -
How can I use a Lookup task to lookup from my SQL Result set and have a join
So in my Control Flow, I have an Execute SQL Task which gets my Table result set. I then have a Foreach Loop Container that iterates through the result set and a Data Flow. The first task in the Data Flow is an OLE DB Source SQL Command that retrieves data
columns associated with my result set. I then do a Derived Column so I can SUBSTRING from one of my data columns and now I want to perform a Lookup to my Application Database.
How do I code my Lookup task to utilize my SQL Result set variable and match on it? I cannot use the GUI for the Lookup task as my Lookup has to have some JOINS in it.
Thanks for your review and am hopeful for a reply.Can you expand on that? I'm sorry but I am new and a novice to the SSIS world and I want to do this as best I can and as efficiently as I can. Are you saying that Rajen's way suggested above is the way to go?
A little background....external data from a 3rd party client. I'v staged that external data to a SQL Server staging table. I have to try and match that data up to our database using SSN, DOB, and Gender...and if I can't match that way then I have to try
and match by Name. I need to make sure that there is only one and only one account for that match. If I cannot match and match one and only one, then I'll create rows on a DataAnomaly Table. If I do match, then I have to check and make sure that there is only
one and only one Member span for that match. Similarly handle the data anomaly and then check and make sure there is a "Diabetes" claim and similarly handle the DataAnomaly accordingly.
That's where I'm at. Sooooo are you saying to use Rajen's suggestion? I don't think I can do that because I need multiple SQL tasks and I cannot connect multiple OLE DB Source tasks.
Any help and suggestions are greatly appreciated.
Thanks. -
"ORA-1722 Invalid number" error while runing a SQL script in SQL*Plus
Hello,
I created a SQL script that is intended to populate tables with
baseline data. When I run the script in the SQL*Plus program
that comes with the Oracle 8.1.6 (client), I receive an "ORA-
1722 Invalid number".
The error always occurs when SQL*Plus tries to execute the
following SQL statement:
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,1046682,'y');
The datatypes for the columns on the components table are as
follows:
db_ind varchar2(2);
module_id number;
ext_compid number;
active varchar2(1);
It seems that for some reason Oracle is having trouble
recognizing 1046682 as a number.
I also tried the following INSERT statements to see if that
would work:
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,to_number('1046682'),'y');
insert into components(db_ind,module_id,ext_compid,active) values
('cm',modules_seq.currval,'1046682','y');
but I still receive the same error message
Is there some NLS setting(s) I need to modify so that Oracle
does not give me this error? Does anyone know the answer to
this problem?
Your help is greatly appreciated.
Oscar
(NOTE: I also receive this same error when trying run the
script in SQL Navigator and Toad programs)Please see the following docs.
R12: JBO-27122 Error Message Clicking On Supplier Accounting Link With Unexpected Error [ID 1218903.1]
Supplier Management Accounting Link Gives Unexpected Error and JBO-27122 at SELECT * FROM (select pvsa.ADDRESS_STYLE [ID 1340655.1]
Adding Accounting Information or Operating Unit Information fails with APP-FND-1564: ORACLE error 1722 in FDFGVD [ID 364265.1]
Thanks,
Hussein -
How to Populate the JTable Object programatically with SQL Results
I'm wondering if someone could help me on how to populate the JTable Object with SQL Results wherein the Row of tjhe JTable object is automatically adjusted depending on how many records you have queried.
Thanks in advance and God bless! (",)
* frmMain.java
* Created on October 4, 2006, 6:15 AM
package tds;
import java.io.*;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.imageio.*;
import javax.swing.JFrame;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
* @author Dexter.Carlit
public class frmMain extends javax.swing.JFrame {
private Connection connection = null;
private DefaultTableModel model;
/** Creates new form frmMain */
public frmMain() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel3 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTree1 = new javax.swing.JTree();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jPanel5 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jGrid = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jProgressBar1 = new javax.swing.JProgressBar();
jPanel2 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
getAccessibleContext().setAccessibleName("frmMain");
jSplitPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jSplitPane.setDividerLocation(200);
jSplitPane.setDividerSize(10);
jScrollPane2.setViewportView(jTree1);
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel3Layout.createSequentialGroup()
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 916, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
jScrollPane1.setViewportView(jPanel3);
jSplitPane.setLeftComponent(jScrollPane1);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setText("First Name:");
jLabel2.setText("Last Name:");
jLabel3.setText("Position :");
jLabel4.setText("Department:");
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Results"));
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jGrid.setColumnSelectionAllowed(true);
jGrid.setName("");
jGrid.setTableHeader(jGrid.getTableHeader());
jScrollPane3.setViewportView(jGrid);
jScrollPane3.getAccessibleContext().setAccessibleName("rset");
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 386, Short.MAX_VALUE)
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
jButton1.setText("Find");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
jButton2.setText("Clear");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.add(1, 1, 1))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4Layout.createSequentialGroup()
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTextField4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
.add(jPanel4Layout.createSequentialGroup()
.add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
jPanel4Layout.linkSize(new java.awt.Component[] {jButton1, jButton2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(jTextField1))
.add(18, 18, 18)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(jTextField2))
.add(16, 16, 16)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField3)
.add(jLabel4)
.add(jTextField4))
.add(14, 14, 14)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jProgressBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE))
.addContainerGap())
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jProgressBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
jTabbedPane1.addTab("Search", jPanel1);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 458, Short.MAX_VALUE)
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 401, Short.MAX_VALUE)
jTabbedPane1.addTab("Directory", jPanel2);
jSplitPane.setRightComponent(jTabbedPane1);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jSplitPane)
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
jGrid.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null},
{null, null, null, null, null, null, null, null, null, null}
new String [] {
"LName", "FName", "Position", "Department", "Office No", "Local No", "Office Mobile No", "Home No", "MobileNo", "Email Address"
jGrid.updateUI();
}//GEN-LAST:event_jButton2MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
try {
//Load and register SQL Server driver
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//Establish a connection
Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://X.X.X.X:1433","MyAccount","MyPassword");
//Create a Statement object
Statement sql_stmt = connection.createStatement();
//Create a ResultSet object, execute the query and return a
// resultset
ResultSet rset = sql_stmt.executeQuery("SELECT * FROM EpxDirectory..Directory Order By LName");
// Populates a JTABLE Object
int i=0;
while (rset.next()){
String LName = rset.getString(1);
String FName = rset.getString(2);
String Position = rset.getString(3);
String Dept_Code = rset.getString(4);
String OffPhoneNo = rset.getString(5);
String LocalNo = rset.getString(6);
String OffMobileNo = rset.getString(7);
String HomePhoneNo = rset.getString(8);
String MobileNo = rset.getString(9);
String Email = rset.getString(10);
jGrid.updateUI();
jGrid.setValueAt(rset.getString(1).trim(),i,0);
jGrid.setValueAt(rset.getString(2).trim(),i,1);
jGrid.setValueAt(rset.getString(3).trim(),i,2);
jGrid.setValueAt(rset.getString(4).trim(),i,3);
jGrid.setValueAt(rset.getString(5).trim(),i,4);
jGrid.setValueAt(rset.getString(6).trim(),i,5);
jGrid.setValueAt(rset.getString(7).trim(),i,6);
jGrid.setValueAt(rset.getString(8).trim(),i,7);
jGrid.setValueAt(rset.getString(9).trim(),i,8);
jGrid.setValueAt(rset.getString(10).trim(),i,9);
i++;
//Close the ResultSet and Statement
rset.close();
sql_stmt.close();
//Close the database connection
connection.close();
System.out.println(Integer.toString(i) + " rows found");
} catch(Exception e) {
System.out.println("Failed to connect; Please view Stack Trace");
e.printStackTrace();
}//GEN-LAST:event_jButton1MouseClicked
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
}//GEN-LAST:event_formWindowOpened
public static void run(){
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
frmMain frmMain = new frmMain();
frmMain.setLocationRelativeTo(null); // Center the JFrame on the
frmMain.setVisible(true);
private void exitApplication() {
// try {
// //gui.putStatus("Closing the connection....please wait.....");
// if(connection != null) {
// // connection.close(); //Closing the connection object.
// } catch(SQLException ex) { //Trap SQLException
// //gui.putStatus(ex.toString());
System.exit(0); //Exit the aplication
* @param args the command line arguments
public static void main(String args[]) {
run();
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JTable jGrid;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTree jTree1;
// End of variables declaration//GEN-END:variables
}Use code tags.
Don't mix GUI and JDBC together. Split them out into separate classes.
You have a good start, but you will need to loop through your resultset and also pull the ResultSet metaData for you column headings
Maybe you are looking for
-
Tomcat not creating a mod_jk.conf-auto file
can anyone tell me why my tomcat (which looks like it is running) is not producing the mod_jk.conf-auto file that I need to include into my httpd.conf?
-
Is it possible to provide autoinstallation of only java plugin not full jre
Hi all I m using the HTML convertor to convert the html pages to deploy the applet in a mixed browser enviornment and also to autodownload the java plugin. It takes quite sometime for the autoinstall the plugin. Is it possible to provide the autodown
-
Web part with managed navigation terms
So I decided to use managed navigation feature for a site I'm working on, however as a requirement, there's a need to have three different sections of navigation (top, side, bottom) and because of the limitation to use only one term set as managed na
-
IPhone keyboard dialing - no sounds
Since installing 4.0.1n there are no sounds when pressing a keys to dial a number. all sounds are enabled. Anyone elso have this issue?
-
Using PXI-8461 CAN controller I am seeing the above warning. What causes it? Can I safely ignore it? thanks