Thursday, November 13, 2014

Missing IN or OUT parameter at index:: 1

The exception occurs when number of values assigned to a query does not equal the columns involved in the query.

The following query when executed throws such an exception.

String sql = "INSERT INTO ORDER VALUES(?, ?, ?,?);
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString("Whole Sale");
ps.setDate(CURRENT_DATE);
ps.setFloat(188.23);
ps.setFloat(1.89);
ps.setString("Kevin Smith");

There are 4 columns in the sql, but it is trying to set 5 values to the query.

---------------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

SQLException: ORA-00984: column not allowed here

The exception occurs when assigning value for inserting or updating records and value given is not properly presented.

The following queries throw such an exception.

String name = "Apple";

1. INSERT INTO FRUIT (NAME, PRICE) values (name, 1.68);

2. UPDATE FRUIT set NAME=name where PRICE=1.68;

To Fix them, do the following.

1. INSERT INTO FRUIT (NAME, PRICE) values ("'"+name+"'", 1.68);

2. UPDATE FRUIT set NAME= "'"+name+"'" where PRICE=1.68;

----------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.


Monday, November 3, 2014

NetBeans: Change the default java platform and add a new java platform

A. Change the default java platform


Open the netbeans.conf file located at <NetBenas home>\etc. change the netbeans_jdkhome=<C:\Program Files\Java\jdk1.8.0_25 or other jdk home>

Restart NetBeans IDE.

B. Add a java platform to the NetBeans:


  1. Click Tools in the top menu of NetBeans IDE, select Java Platforms.
  2. In the pop up window, click the "Add platform..." button at the left bottom.
  3. Select the jdk you would like to add, click "Next >".
  4. Enter a platform name and click "Finish".
-------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

Desktop shortcut throws C:\ProgramData\Oracle\Java\javapath\java.exe The specified path does not exist

When you double click the desktop shortcut for executing your Java program, the following message pops up.


To fix this, right-click on your desktop shortcut icon and select Properties. In the Target field in the new pop up window, type 'java <your execute program>' or 'java -jar <your executable jar name>', then click the "Apply" button at the bottom, it will automatically put the correct path in the Target field.
       
----------------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

Oracle: Save query result to a local spread sheet or text file with fields separated by comma, pipeline, or other characters


At the command prompt, type sqlplus <username>/<password>, then hit enter.

Do the following to save to a file.

SQL> SPOOL <file path/file name><.txt or .csv> CREATE/APPEND/REPLACE
   
      (By default, the option is REPLACE if you don't specify it.)

SQL> SET colsep <delimiter such as ,  or |>

//Print the column header to the output file. Default is ON
SQL> SET head ON/OFF

//Print underline beneath the column headers. Default is ON
SQL> SET UNDERLINE ON/OFF

//Print the total number of rows selected
SQL> SET FEEDBACK ON/OFF

SQL> <your SELECT sql statement>

SQL> SPOOL OFF

-------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.