Foni kumar

Ranch Hand
+ Follow
since Sep 19, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Foni kumar

Dave Tolls wrote:Can you put that code inside code tags?

Also, that lot won't compile, the executeQuery line is missing a closing quotes and bracket.

ALL is valid, but I'm not sure it's required is it? It's the default for a statement, so i's a bit redundant.

Can you post the full stack trace and message and highlight the exact line in your code the error is thrown from?



Dave Tolls wrote:Can you put that code inside code tags?

Also, that lot won't compile, the executeQuery line is missing a closing quotes and bracket.

ALL is valid, but I'm not sure it's required is it? It's the default for a statement, so i's a bit redundant.

Can you post the full stack trace and message and highlight the exact line in your code the error is thrown from?



Hello,

Below is my entire code, and I am getting error as below upon execution of the code. Kindly suggest.

java.sql.SQLException: Fail to convert to internal representation

8 years ago
Hello,

My requirement is to establish a DB connection with Oracl Database 11g and query the column values for the DB table named emp_records_sp.For the below code,I am able to collect the value in result set and create the cells in excel sheet but the database table column values are not getting set for the respective column names as created in the excel sheet during the result set iteration process.

Each time during the execution of the rs, It ends up in the below error message.

Can anyone help if I am doing some mistake in the below code during execution of the code?

java.sql.SQLException: Fail to convert to internal representation



PROBLEMATIC CODE SNIPPET:

while(rs.next()){
System.out.println("Hi 3");
HSSFRow row = sheet.createRow((short)index);
System.out.println("Hi 4");
row.createCell((int)0).setCellValue(rs.getInt(1));







ACTUAL CODE :

Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select all emp_records.id, emp_records.category, emp_records.type,emp_records.city,emp_records.bu, from emp_records_sp;
System.out.println("Hi 1");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Excel Sheet");
HSSFRow rowhead = sheet.createRow((short)0);
rowhead.createCell((int) 0).setCellValue("ID");
rowhead.createCell((char) 1).setCellValue("Category");
rowhead.createCell((char) 2).setCellValue("Type");
rowhead.createCell((int) 3).setCellValue("City");
rowhead.createCell((char) 4).setCellValue("BU");
System.out.println("Hi 2");
int index=1;
while(rs.next()){
System.out.println("Hi 3");
HSSFRow row = sheet.createRow((short)index);
row.createCell((int)0).setCellValue(rs.getInt(1));
row.createCell((char)1).setCellValue(rs.getString(2));
row.createCell((char)2).setCellValue(rs.getString(3));
row.createCell((int)3).setCellValue(rs.getInt(4));
row.createCell((char)4).setCellValue(rs.getString(5));
index++;
}
8 years ago
Hi experts,

How can I read the most recent file where my file names are like : test_21_June_2014.txt, test_22_June_2014,test_23_June_2014.txt in my below code. At present it is reading the test.txt file. Can someone suggest me how to read the most recent file where the name of the file has the date stamp to determine which is the recent file version.




Hi experts,
1)How can I put the Username: ,Password: and Submit: button in the center alignment of the page within a square box and bold border surrounding it?Any sample codes can be helpful.
2)Can someone suggest me how can I correct this in my below code? I want the validation to happen first and then then if it is passing the validation, then the user can move to next page. Currently it is moving to the next page "index.html" on click of submit button.

Ulf Dittmer wrote:That's what the <welcome-file-list> tag in your web.xml is for.



Thanks for the reply but how can I shorten this URL link http://localhost:8080/monitor/index.html to a friednly url . Can you provide me some steps so that I will be clear about this approach?
9 years ago
Hi All,

I want to modify my application URL http://localhost:8080/monitor/index.html to just monitor , so that on putting monitor on browser, my application should open. Is there a way to achieve this, can someone suggest the configuration changes which will be required for this.

Thanks and regards
Deb
9 years ago
Hi All,

Can someone suggest me how can I read a text file present in my local directory say (C://test.txt) , iterate and populate the values of test.txt into a text area of the JSP page? Can anyone provide any sample code in this context to get an understanding about the approach to be followed.

Contents in the test.txt file:

username:test
password:test123
domain:test321
DBname:testDB




Thanks and regards
Deb
9 years ago
JSP

Jarrod Rackley wrote:Here is a simple example that grabs a text file and prints it's contents.



The text file contains:



That should help get you started. You can also check out the java tutorials here and I have found some of the examples and tutorials here helpful as well.

**Edit**
Removed some unused attributes I had in.

**Edit 2**

Instead of doing System.out.println() you can print the text into a JTextArea, JLabel, or a number of other components that you can add to the JPanel. Also if you are going to mess with the String a lot, it might be easier to use a StringBuilder instead of just String.



Hi Jarrod ,

Thanks for the reply but can you suggest how can I add a text Area to my below panel code since I tried to do it but it is not working? Here I want to add a text area with some heading say [b]"Details" under my panel (TAB2) and then I want to populate the text.txt file contents in that.[/b] . Can you please suggest how can I add a text area in my below code.


9 years ago

Jarrod Rackley wrote:With info like that I think a properties file would be better.

But I would say use java.io.File and then you could read and print that line by line, or grab chunks based off keywords.



I am new to this concept of reading and writing from text file to the pane window. Can you please demonstrate some codes that will help?
9 years ago
Hi All,

I have my below Swing GUI code in which I want to read and display some contents present in text file say (test.txt) which is located in my local disk (C:\test.txt). My pane tab 2 is divided into two halves horizontally.Can anyone suggest me how can I read and write the test.txt file contents under the tab tab2 in the first half of the pane(where currently it is 2 written)?

Sample test.txt present in my local hard disk location


CODE FOR TABBED PANE


Thanks and Regards
Deb
9 years ago

Tony Docherty wrote:Have you tried compiling and running it to see what happens?

BTW are you sure your NewExcelNewExcel test = new NewExcel(); line shouldn't just be:

I ask because your text object seems to be calling methods that are in the ReadExcel class.



I think you guys are right. I will try to compile after making the changes and will post then.
9 years ago

Winston Gutkowski wrote:

Foni kumar wrote:Can someone suggest me why I am getting the error message :-


Yes. Because the compiler doesn't know what a NewExcel is. Is it a class from a library? Or one that you wrote yourself? Either way, if it's not in the same package as your ReadExcel class, you'll have to add an 'import' statement for it.

Winston



Thank-you for your suggestions. Can the below change help, please correct me if I am getting it wrong. As I have declared the classname as NewExcel.

9 years ago
Hi Experts,

I am getting the error message as Exception in thread "main" java.lang.Error: Unresolved compilation problems: NewExcel cannot be resolved to a type for the line NewExcel test = new NewExcel(); in the below code to read the columns from an excelsheet "test.xls". Can someone suggest me why I am getting the error message :-



Thanks and Regards
Debashis
9 years ago

Bear Bibeault wrote:Nothing to do with JSP, moved to HTML/JavaScript.

Have you done a search on how to set cookies in JavaScript?



Hi Bear,

Ya I did but not get much idea or clarity for the approach to do this as I haven't implemented the cookie session concepts anytime in past. I was thinking to save the values of my check-box state in cookie and call them in the onbeforeunload event but unfortunately haven't used this function too before.

Can you please suggest some code snippets in this context that can help me? The change I want to do here is on page refresh the checkbox state(checked state) should be maintained even if we navigate to other page or refresh the browser in that particular browser session.

Would appreciate for your guidance in this