How do I convert ClobDomain to java.sql.Clob?
I have an instance of oracle.jbo.domain.ClobDomain and i need
to convert it to oracle.sql.CLOB. How do I do this?
Sascha, I tried your solution:
clobData = (CLOB) content.getData();
Alas, it does not work. Although content has a value, clobData becomes null
Also, if I take a look in the source ClobDomain.data, the method getData has the following
comment:
* Internal:Applications should not use this method.
Does anybody know a way out?
lebbol
Similar Messages
-
How to update java.sql.Clob using javax.persistence.EntityManager?
Hello.
Can anyone tell me (or show me some example) how to update java.sql.Clob using javax.persistence.EntityManager.
When Im trying to update column (with type Clob) value is not inserting, after update column is empty. I havent any error during update, Im using database Oracle 10g.
Edited by: ernest211 on Jul 16, 2009 1:24 AMPost some code so we can see how you are doing it. If you are using JPA entities take a look at the @Lob annotation.
m -
Converting String to java.sql.Time
i have got a string like String time = "12:08 P.M.";
I want to convert it to java.sql.Time .
Please anyone suggest me the solution.CROSSPOST: http://forum.java.sun.com/thread.jspa?threadID=5162798&messageID=9621227
A crosspost with only 2 postings. Is that a new record? Or does it just tie the record :-) -
Problem with java.sql.Clob and oracle.sql.CLOB
Hi,
I am using oracle9i and SAP web application server. I am getClob method and storing that in java.sql.Clob and using the getClass().getName() I am getting the class name as oracle.sql.CLOB. But when I am trying to cast this to oracle.sql.CLOB i am getting ClassCastException. The code is given below
java.sql.Clob lOracleClob = lResultSet.getClob(lColIndex + 1);
lPrintWriter = new PrintWriter(new BufferedWriter (((oracle.sql.CLOB) lOracleClob).getCharacterOutputStream()));
lResourceStatus = true;
can anybody please tell me the what is the problem with this and solution.
thanks,
Ashok.Hi Ashok
You can get a "ClassCastException" when the JVM doesn't have access to the specific class (in your case, "oracle.sql.CLOB").
Just check your classpath and see if you are referring to the correct jar files.
cheers
Sameer
PS: Please award points if you find the answer useful -
Needed help regarding converting string to java.sql.Date format
I have a a function which returns a calendar object. The date must be inserted to Oracle DB using java.sql.Date format.
So i have converted the Calendar object to java.sql.Date format using the following code
java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());But while getting inserted into the DB it was in mm/dd/yyyy format whereas i wanted dd/mm/yyyy format
Can any body please help out how to store the date in dd/mm/yyyy format ?Can u please explain this a bit
This is my code
public int addBook(List<Book> BookList) throws SQLException, ParseException{
System.out.println("Hi there");
Book book = new Book();
BookDB bookDb = new BookDB();
//listLength = BookList.length;
String bookId = null;
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection("jdbc:oracle:thin:@10.123.79.195:1521:findb01","e115314", "e115314");
addBook = con.prepareStatement("insert into ABC_Book values(?,?,?,?,?,?,?)");
Iterator<Book> iterator = BookList.iterator();
while(iterator.hasNext()){
book = (Book)iterator.next();
System.out.println(book.getBookId());
addBook.setString(1,book.getBookId());
addBook.setString(2,book.getTitle());
addBook.setString(3,book.getAuthor());
addBook.setString(4,book.getPublisher());
System.out.println(book.getPublicationDate());
System.out.println("Before Date");
System.out.println("book.getPublicationDate().getTime()"+book.getPublicationDate().getTime());
java.sql.Date publicationDate = new java.sql.Date(book.getPublicationDate().getTime().getTime());
SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yyyy");
dateString = formatter.format(publicationDate);
System.out.println("Today is"+dateString);
java.sql.Date date = (java.sql.Date)formatter.parse(dateString);
System.out.println("date"+date);
//java.sql.Date publicationDate = (Date)book.getPublicationDate().getTime();
//System.out.println("Value of date is"+publicationDate);
System.out.println("After Date");
addBook.setDate(5,publicationDate);
addBook.setString(6,book.getCountry());
addBook.setString(7,book.getLanguage());
rs = addBook.executeQuery();
//con.commit();
rowCount = rowCount + rs.getRow();
return rowCount;
catch(SQLException se){
se.printStackTrace();
finally{
con.close();
System.out.println("After adding ");
return 0;
} -
Trying to convert String to java.sql.Date
I need to convert a String (in the format "yyyy-mm-dd") to java.sql.Date
It was suggested I use the following,
SimpleDateFormat formater = new SimpleDateFormat("yyyy-mm-dd");
Date result = formater.parse(dbirth.getText());
However, It seem to produce a java.util.Date
Error: found java.util.Date
Required : java.sql.Date
Can anyone help?
Thanks, MarikaI need to convert a String (in the format
"yyyy-mm-dd") to java.sql.Date
It was suggested I use the following,
SimpleDateFormat formater = new
SimpleDateFormat("yyyy-mm-dd");
Date result = formater.parse(dbirth.getText());
However, It seem to produce a java.util.Date
Error: found java.util.Date
Required : java.sql.Date
Can anyone help?
Thanks, Marika SimpleDateFormat formater = new SimpleDateFormat("yyyy-mm-dd");
java.util.Date parsedDate = formater.parse(dbirth.getText());
java.sql.Date result = new java.sql.Date(parsedDate.getTime()); -
How do I create a Dynamic java.sql.Date ArrayList or Collection?
I Have a MySQL table with a Datetime field with many values inserted.
I want to know which is the Best way to capture all the Inserted DB values inside a Dynamic Array.
I get errors that state that I should use Matching data-types, and plus I don't know how to create or fill a Dynamic Date ArrayList/Collection.
Please Help, I need this urgently...package pruebadedates;
import java.sql.*;
* @author J?s?
public class ClaseDeDates {
/** Creates a new instance of ClaseDeDates */
* @param args the command line arguments
public static void main(String[] args) {
java.sql.Date aDate[] = null;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost/pruebafechas", "root", "picardias");
if(!con.isClosed()){
stmt = con.createStatement();
stmt.executeQuery ("SELECT dates FROM datestable");
rs = stmt.getResultSet();
while (rs.next())
aDate[] = rs.getDate("dates");
catch(Exception e)
System.out.println(e);
//System.out.println(aDate);
}Hi, There is my code and the errors that I get are:
found : java.sql.Date
required: java.sql.Date[]
aDate = rs.getDate("dates");
Actually I have No idea as How to get a Result set into an ArrayList or Collection. Please tell me how to do this Dynamically. I have like 25 records in that Database table, but they will grow, so I would really appreciate to know the code to do this. I suspect my problem is in the bolded part of my code.
Thank you very much Sir. -
Convert Calendar to Java.sql.Date
I seached for a solution for converting a Calendar-object to a java.sql.date for inserting it into a MySQL DB (DateTime). I know this question is a FAQ. The solution I found is the following code:
java.sql.Date sqlDate = new java.sql.Date(cal.getTime().getTime() );When i do a print of the sqlDate to the console I get: sqlDate: 2005-06-27
But when I look into de DB I get the following date: 27/05/1905
I know that in Java the months are starting from 0-�11 and that the years counting is starting from 1900. But I assume that the solution is not to just add the correct month and year manually. because I get a correct console-output. If I do this I get a correct DB Date, but a wrong console-date.II dont know if you found an answer but I needed a similar solution so I wrote a test program.
Let me know if this solves the problem for you.
import java.util.*;
import java.sql.*;
public class dateTest{
public static void main(String args[]){
// Step by step
// Calendar rightNow = Calendar.getInstance();
// java.util.Date today = rightNow.getTime();
// long theTime = today.getTime();
// java.sql.Date sDate = new java.sql.Date(theTime);
// In one line
java.sql.Date sDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
System.out.println("sDate is: "+sDate.toString());
} -
Convert string into java.sql.Date
Hi,
I want to convert a date in string form into java.sql.Date to persist into the database column with Date as its datatype in Oracle. I'm trying as follows:
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class DateTest
public static void main(String[] args)
String strDate = "2002-07-16 14:45:01";
System.out.println("strDate = "+strDate);
Date aDate = null;
try
if(strDate != null && !strDate.trim().equals(""))
SimpleDateFormat aSDF = new SimpleDateFormat();
aSDF.applyPattern("yyyy-MM-dd hh:mm:ss");
java.util.Date utilDate = aSDF.parse(strDate);
System.out.println("utildate = "+utilDate);
aDate = new Date(utilDate.getTime());
aDate.setTime(utilDate.getTime());
System.out.println("aDate = "+aDate);
catch (ParseException e)
System.out.println("Unable to parse the date - "+strDate);
catch (Exception ex)
ex.printStackTrace();
System.out.println("Caught Exception :"+ex.getMessage());
It gives the output as :
strDate = 2002-07-16 14:45:01
utildate = Tue Jul 16 14:45:01 IST 2002
aDate = 2002-07-16
If I put this value into the database table, I can see only the date. Time part is missing. Is this the problem with java.sql.Date or Oracle datatype Date? Please help me asap.
Thanks in advance.
Regards,
Rajapriya.R.If I put this value into the database table, I can
see only the date. Time part is missing. Is this the
problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it. -
hi all,
I am trying to save an image (blob) into oracle. When i try this i am getting following error.
java.sql.SQLException: ORA-01465: invalid hex number
BLOB blob = BLOB.createTemporary(con , false, BLOB.DURATION_SESSION);
String dir = "C:\\opt\\temp";
File binaryFile = new File(dir+"/"+filename);
FileInputStream instream = new FileInputStream(binaryFile);
OutputStream outstream = blob.setBinaryStream(1L);
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = instream.read(buffer)) != -1)
outstream.write(buffer, 0, length);
instream.close();
outstream.close();
System.out.println("blob:>>>>>>"+blob);
String sqlText =
"INSERT INTO test_fileupload (filename, blobfile) " +
" VALUES('" + filename + "','" + outstream + "')";
st.executeUpdate(sqlText);
con.commit();In the above Insert statement i tried with "blob" insted of "outstream" still same but when i try with the string "3s34se"
it is inserting into database..
I am new to blob can any one explain me why is like that.
Thanq in adv.
Edited by: Ajayuppalapati on Nov 21, 2008 4:40 PMORA-01465: invalid hex number
[http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=012434]
[http://forums.sun.com/thread.jspa?threadID=261091&forumID=31] -
How do I convert a £ sign iN SQL..?
hello.
I know ORACLE SQL doesn't mind a £ sign (converts it to a hash in TOAD) but as I'm using a
SELECT statement in a BI Publisher Data Template that is used to generate an XML file -
the XML generator doesn't like it..
So. Could somebody please tell me how I convert a £ sign if and when it appears in a record
that is returned in my query..?
here's the query (not that it matters!?!?!!)
SELECT DISTINCT
PB.CONCURRENT_PROGRAM_NAME PROGRAM_SHORT_NAME ,
TO_CHAR(R.REQUEST_DATE, 'dd-MON-yyyy') REQUEST_DATE, R.DESCRIPTION,
** this is the field ** PT.USER_CONCURRENT_PROGRAM_NAME PROGRAM_NAME ** this is the field **
FROM
FND_CONCURRENT_PROGRAMS_TL PT,
FND_CONCURRENT_PROGRAMS PB,
FND_USER U,
FND_PRINTER_STYLES_TL S,
FND_CONCURRENT_REQUESTS R
WHERE PB.APPLICATION_ID = R.PROGRAM_APPLICATION_ID
AND PB.CONCURRENT_PROGRAM_ID = R.CONCURRENT_PROGRAM_ID
AND PB.APPLICATION_ID = PT.APPLICATION_ID
AND PB.CONCURRENT_PROGRAM_ID = PT.CONCURRENT_PROGRAM_ID
AND PT.LANGUAGE = USERENV('LANG') AND U.USER_ID = R.REQUESTED_BY
AND S.PRINTER_STYLE_NAME(+) = R.PRINT_STYLE
AND S.LANGUAGE(+) = USERENV('LANG')
AND PT.USER_CONCURRENT_PROGRAM_NAME LIKE 'UofS%'
AND TRUNC(R.REQUEST_DATE) = '02-feb-10' Many thanks..
Steven
Edited by: JackyWhite on Mar 30, 2010 4:26 PMOk thanks for all your comments but I've found a way round it.
All I've done is make sure the xml file produced to be attached to the rtf file does not contain any fields with the £sign in it.
For all subsequent runs of the Conc Program where the £sign may be produced in the report PDF, Excel, etc. formats happily produce the character when generated.
Not a solution really, but hey, its working!
Steven -
How do I convert my GUI java app to be an applet or display it on a webpage
I have created a loan calculator program in netbeans, I got the application to run fine but now I want to add it into a html page.
I'm just looking for a place to start, I just don't know where to go from here, I want to know if I can actually convert my app with a few changes to an applet or if any one can point me to a forum of similar interest or tutorials that explain what I'm looking for.
I don't even know what i'm looking for except i want this program to run on a webpage.
Or is there a way to run my .jar file on a webpage??
My teacher has not taught us anything on this matter except the below code suggestions on converting and my program is more extensive than her examples for converting. This is what she briefly described on this subject.
1.To convert an application to an applet the main differences are: import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JOptionPane;
Extend JApplet Replace main with public void init() method
Output with public void paint( Graphics g ) method
2. Remove calls to setSize, setTitle, pack, and any window listener calls, e.g., setDefaultCloseOperation. Compile the program---if something doesn't compile just comment it out for now.
3. Create a simple web page with the following body.
<applet CODE="__________.class" WIDTH="300" HEIGHT="300"
archive="http://www.cs.duke.edu/courses/fall01/cps108/resources/joggle.jar">
Your browser does not support applets </applet>
I understand those steps for a simple program like hello world but not my current app
Heres my code on the 2 extend off my first GUI of the Loan Application
public class AnalysisGUI extends GUI {
/** Creates new form AnalysisGUI */
public AnalysisGUI(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}//end constructor
private DecimalFormat currency = new DecimalFormat("0.00");
/** 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">
private void initComponents() {
analysisjButton = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
writejTextArea = new javax.swing.JTextArea();
clearTextAreajButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
analysisjButton.setText("Analysis");
analysisjButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
analysisjButtonActionPerformed(evt);
writejTextArea.setColumns(20);
writejTextArea.setRows(5);
jScrollPane1.setViewportView(writejTextArea);
clearTextAreajButton.setText("Clear Analysis Output");
clearTextAreajButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearTextAreajButtonActionPerformed(evt);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(analysisjButton)
.addComponent(clearTextAreajButton))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 433, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(86, 86, 86))
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(306, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(analysisjButton)
.addGap(84, 84, 84)
.addComponent(clearTextAreajButton)
.addGap(113, 113, 113))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(22, 22, 22))))
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-700)/2, (screenSize.height-627)/2, 700, 627);
}// </editor-fold>
private void analysisjButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//importing values for FOR loop of 13 pyaments a years
ir13 = super.rate;
balance13 = super.balance;
time13 = super.time;
payment13 = MortgageCalculator.CalculatePayment(ir13, balance13, time13, PayperYear13);
interest13 = round((balance13 * (ir13/PayperYear13)));
principle13 = round(payment13 - interest13);
//set up for 12 pyaments a year
balance = super.balance;
ir = super.rate;
time = super.time;
payment = super.payment;
interest = round((balance * (ir/PayperYear12)));
principle = round(payment - interest);
//set up for 24 payments a year
balance24 = super.balance;
ir24 = super.rate;
time24 = super.time;
payment24 = super.payment/2;
interest24 = round((balance24 * (ir/PayperYear24)));
principle24 = round(payment24 - interest24);
//set up for 26 payemnts a years
ir26 = super.rate;
balance26 = super.balance;
time26 = super.time;
payment26 = MortgageCalculator.CalculatePayment(ir26, balance26, time26, PayperYear26);
interest26 = round((balance26 * (ir26/PayperYear26)));
principle26 = round(payment26 - interest26);
double totalPrinciple = 0; //set to zero
double totalInterest = 0; //set to zero
for( int n = 0; n < time; n++) //check Year of Loan
totalPrinciple = 0; //reset to zero for totaling Year n totals
totalInterest = 0; //reset to zero for totaling Year n totals
writejTextArea.append("-----Based on 12 Payments Per Year-----\n");
writejTextArea.append(" "+" "+"Principle" + " " +
"Interest"+ " "+
"Balance"+"\n");
//loops through the monthly payments
for(int i = 1; i <= PayperYear12; i++ )
//Calculate applied amounts for chart to be printed
interest = round((balance * ir)/PayperYear12);
principle = round(payment - interest);
balance = round(balance - principle);
//total year end amounts
totalPrinciple = totalPrinciple + principle;
totalInterest = totalInterest + interest;
writejTextArea.append("Payment " + i + " $" + currency.format(principle) + " " +
currency.format(interest) + " $" +
currency.format(balance)+"\n");
}//end for 12 payments per year
//print 12 payments Totals
int yr = n + 1;
writejTextArea.append("\n---Year " + yr + " Totals Based on 12 Payments Per Year---");
writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple));
writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest));
writejTextArea.append("\nRemaining Balance: $" + currency.format(balance)+"\n");
writejTextArea.append("\n-------------------------------------------------------\n");
//Start 13 PAYMENTS A YEAR TABLE
double totalPrinciple13 = 0; //reset to zero for totaling Year n totals
double totalInterest13 = 0; //reset to zero for totaling Year n totals
writejTextArea.append("-----Based on 13 Payments Per Year-----\n");
writejTextArea.append(" "+" "+"Principle" + " " +
"Interest"+ " "+
"Balance"+"\n");
//loops through the monthly 13 payments
for(int j = 1; j <= PayperYear13; j++ )
//Calculate applied amounts for chart to be printed
interest13 = round((balance13 * ir13)/PayperYear13);
principle13 = round(payment13 - interest13);
balance13 = round(balance13 - principle13);
//total year end amounts
totalPrinciple13 = totalPrinciple13 + principle13;
totalInterest13 = totalInterest13 + interest13;
//System.out.printf("\n%-10s %-10s %-10s %-10s %-10s", n + 1 , i + 1,Principle, Interest, Balance);
//System.out.printf("\n%-10s %-10s %-10.2f %-10.2f %-10.2f", n + 1 , i + 1,round(principle), round(interest), balance);
writejTextArea.append("Payment " + j + " $" + currency.format(principle13) + " " +
currency.format(interest13) + " $" +
currency.format(balance13)+"\n");
}//end for 13 payments per year
//Print totals for 13 payments a year
yr = n + 1;
writejTextArea.append("\n---Year " + yr + " Totals Based on 13 Payments Per Year---");
writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple13));
writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest13));
writejTextArea.append("\nRemaining Balance: $" + currency.format(balance13)+"\n");
writejTextArea.append("\n-------------------------------------------------------\n");
//Start 24 PAYMENTS A YEAR TABLE
double totalPrinciple24 = 0; //reset to zero for totaling Year n totals
double totalInterest24 = 0; //reset to zero for totaling Year n totals
writejTextArea.append("-----Based on 24 Payments Per Year-----\n");
writejTextArea.append(" "+" "+"Principle" + " " +
"Interest"+ " "+
"Balance"+"\n");
//loops through the monthly payments
for(int i = 1; i <= PayperYear24; i++ )
//Calculate applied amounts for chart to be printed
interest24 = round((balance24 * ir24)/PayperYear24);
principle24 = round(payment24 - interest24);
balance24 = round(balance24 - principle24);
//total year end amounts
totalPrinciple = totalPrinciple + principle24;
totalInterest = totalInterest + interest24;
writejTextArea.append("Payment " + i + " $" + currency.format(principle24) + " " +
currency.format(interest24) + " $" +
currency.format(balance24)+"\n");
}//end for 24 payments per year
//print 24 payments Totals
yr = n +1;
writejTextArea.append("\n---Year " + yr + " Totals Based on 24 Payments Per Year---");
writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple24));
writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest24));
writejTextArea.append("\nRemaining Balance: $" + currency.format(balance24)+"\n");
writejTextArea.append("\n-------------------------------------------------------\n");
//Start 26 PAYMENTS A YEAR TABLE
double totalPrinciple26 = 0;//reset to zero for totaling Year n totals
double totalInterest26 = 0; //reset to zero for totaling Year n totals
writejTextArea.append("------Based on 26 Payments Per Year-----\n");
writejTextArea.append(" "+" "+"Principle" + " " +
"Interest"+ " "+
"Balance"+"\n");
//loops through the monthly payments 26 times
for(int i = 1; i <= PayperYear26; i++ )
//Calculate applied amounts for chart to be printed
interest26 = round((balance26 * ir24)/PayperYear26);
principle26 = round(payment26 - interest26);
balance26 = round(balance26 - principle26);
totalPrinciple = totalPrinciple + principle26;
totalInterest = totalInterest + interest26;
writejTextArea.append("Payment " + i + " $" + currency.format(principle26) + " " +
currency.format(interest26) + " $" +
currency.format(balance26)+"\n");
}//end for 26 payments per year
yr = n + 1;
//prints 26 payments yearly totals
writejTextArea.append("\n---Year " + yr + " Totals Based on 26 Payments Per Year---");
writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple26));
writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest26));
writejTextArea.append("\nRemaining Balance: $" + currency.format(balance26)+"\n");
writejTextArea.append("\n-------------------------------------------------------\n");
}//end for years of the loan
private void clearTextAreajButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//clear analysis field
writejTextArea.setText("");
public static double round(double r)//round to cents method
return Math.ceil(r*100)/100;
}//end round
/**HI micha what a long progam
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
AnalysisGUI dialog = new AnalysisGUI(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
dialog.setVisible(true);
});//end announymous
}//end main mehtod
//12 year declared varialbes
//private double balance;
private double principle;
private double ir;
private double interest;
private double PayperYear12 = 12;
//Variables for 13 payments a years
private int PayperYear13 = 13;
private double balance13;
private double principle13;
private double ir13;
private double interest13;
private double payment13;
private double time13;
//Varialbes for 24 payments a year
private int PayperYear24 = 24;
private double balance24;
private double principle24;
private double ir24;
private double interest24;
private double payment24;
private double time24;
//Varialbes for 24 payments a year
private int PayperYear26 = 26;
private double balance26;
private double principle26;
private double ir26;
private double interest26;
private double payment26;
private double time26;
// Variables declaration - do not modify
private javax.swing.JButton analysisjButton;
private javax.swing.JButton clearTextAreajButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea writejTextArea;Your original program extends "GUI" which appears to extend JFrame (correct me if I'm wrong). If so, the first thing you should do would be to re-write this so that it extends JPanel which shouldn't be that hard to do (at least it's not hard to do if you know a little Swing -- but I worry about someone coming into this from the netbeans-generated code world). Purists will tell you to not even extend this, to have your main GUI class hold an instance of JPanel instead, and this would work fine too, as long as one way or another, the main GUI program can produce your application displayed on a JPanel on demand.
If you've done this correctly, then using your JPanel in a JFrame is trivial: in a main method create a JFrame, and then simply add your JPanel to the JFrame's contentPane and display it. Likewise using your JPanel in a JApplet is just as trivial as you'd do essentially the same thing: add your JPanel to the JApplet's contentPane, but this time do it in the JApplet's init method. -
How can I convert this small pl/sql block in a single query?
Hello,
I need to have a single SQL query which gives the same output as the following piece of code, which uses a cursor to iterate on the rows in order to get the informations I need:
declare
cursor c(p varchar2) is
select context_id, id, parent_id
from CONTEXT_CONTEXT
start with parent_id is null
and context_id = p
connect by prior id = parent_id
and context_id = p;
begin
for r in (select context_id from ALL_CONTEXTS where context_type in ('MYTYPE'))
loop
for j in c(r.context_id)
loop
-- I want to obtain the values of the following colums from a query:
dbms_output.put_line(j.context_id || ' ' || j.id || ' ' || j.parent_id);
end loop;
end loop;
end;
Additional informations:
CONTEXT_CONTEXT.context_id references ALL_CONTEXTS.id
CONTEXT_CONTEXT.id references ALL_CONTEXTS.id as well
CONTEXT_CONTEXT.parent_id references ALL_CONTEXTS.id as well
id is primary key of ALL_CONTEXTS
(context_id, id) is primary key of CONTEXT_CONTEXT
*/user10047839 wrote:
Unfortunately, the CONNECT_BY_ROOT is not supported by my version of the DB 9i.
SELECT context_id,
SUBSTR(
SYS_CONNECT_BY_PATH(context_id,'/'),
2,
INSTR(
SYS_CONNECT_BY_PATH(context_id,'/') || '/',
1,
2
) - 2
) AS parent_context_id
FROM CONTEXT_CONTEXT
START WITH parent_id IS NULL
AND context_id IN (
SELECT context_id
FROM all_contexts
WHERE context_type IN ('MYTYPE')
CONNECT BY PRIOR ID = parent_id
AND context_id = PRIOR context_id;SY. -
BC4J - How can I get java.sql.Connection ?
Hi,
I am using BC4J for my Application and want to get the java.sql.Connection from ApplicationModule or from anywhere such that I can use the same connection as in ApplicaitonModule, to do some work in the database.
I tried to get it from the SessionInfo :
sessioninfo.getConnectionInfo();
but this returns me oracle.dacf.dataset.connections.Connection
How can I convert this to java.sql.Connection?
Or Is there any other means to get hold of sql.Connection?
Any help would be appreciated.
TIAThanks for this reply.. but
I need java.sql.Connection to call a stored procedure in Oracle database and I have to pass oracle.sql.ARRAY to it.
My Stored Procedure looks like:
create or replace PROCEDURE updateRevenueNetworkInfo(revid varchar2, netids Varchar32Array)
where 'Varchar32Array' is my own datatype in the database which is mapped to oracle.sql.ARRAY object in java.
And in order to create oracle.sql.ARRAY I need java.sql.Connection as shown below
oracle.sql.ARRAY pTable = new oracle.sql.ARRAY(desc, connection, netidarray);
I am executing my stored procedure like this:
ArrayDescriptor desc = null; CallableStatement cs = null;
String[] netidarray = {"00-AOL-T1-N003"};
desc = ArrayDescriptor.createDescriptor("VARCHAR32ARRAY", conn);
oracle.sql.ARRAY pTable = new ARRAY(desc, connection, netidarray);
cs = conn.prepareCall( "BEGIN updaterevenuenetworkinfo(?,?); END;" );
((OracleCallableStatement)cs).setString(1,"00-AOL-T1-R3");
((OracleCallableStatement)cs).setArray(2, pTable);
cs.execute();
Is there any way of getting java.sql.Connection such that I can use the same connection as in the ApplicationModule?
OR Is there any other way of passing Array of Strings to a stored procedure in the database?
Thanks for the help.
null -
How to convert JAVA.SQL.DATE date in YYYY/MM/DD format into DD/MM/YYYY
i am using informix database which accepts date value in the form of DATE format......
the other part of my application takes date from the field in DD/MM/YYYY format...so i have to convert my java.sql.date in YYYY/MM/DD fromat into DD/MM/YYYY fromat of same type before inserting into db......
but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
and also using format method can result only in string conversion........816399 wrote:
i am using informix database which accepts date value in the form of DATE format......Huh?
Maybe you mean Informix (fronted by JDBC) expects date values as java.sql.Date objects?
the other part of my application takes date from the field in DD/MM/YYYY format...
so i have to convert my java.sql.date in YYYY/MM/DD format into DD/MM/YYYY format of same type before inserting into db......I am not sure why you are talking about formats here.
There is no formatting inherent in a java.util.Date object
nor in a java.sql.Date object.
but using parse method in SimpleDateFormat class can get the result only in java.util.date format...
and also using format method can result only in string conversion........You can easily create a java.sql.Date object from a java.util.Date object.
String s = "31/12/2010";
java.util.Date ud = new java.text.SimpleDateFormat("dd/MM/yyyy").parse(s);
java.sql.Date sd = new java.sql.Date(ud.getTime());
ud = sd; // java.sql.Date extends java.util.Date so no conversion is needed
Maybe you are looking for
-
I cannot open Keynote and Pages in iPhone/iPad iOS 7
After updating to iOS 7 and iWork for iOS, I'm no loger able to use iWork for iOS when iCloud is turned on. I've two apple accounts, one for Mexico store and another one for US store. A couple of yeard ago I purchased Numbers for iphone/ipad using MX
-
I am getting a blocked plug in message
I am getting a blocked plug in message. I am trying to install the latest flash player but get to a user and password box and don't know the password. How do I get or reset that password so I can download?
-
Estimate for Implementing Information Broadcasting
Hi, Our customer is interested in installing the Information Broadcasting feature in their BW system. The BW version they have is SAP BW 3.5, data is fetched from different Legacy systems into the BW systems. No R3 is involved. We have also got the r
-
my iPad screen is not responding, whats the best way to clean it and what could be the problem, its 2 days old
-
GoLive conversion to Dreamweaver
I have an existing site that was created in GoLive. How do I move this site and all its assets to Dreamweaver?