Srikanth Ravuri

Greenhorn
+ Follow
since Jan 26, 2011
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
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Srikanth Ravuri

Rob Spoor wrote:Don't reinvent the wheel, and use an existing CSV library. You can find some in our AccessingFileFormats FAQ, under Excel. I myself have used opencsv successfully quite a few times.



Thanks Rob

I am new to java and don't have much knowledge in CSV library. I will study more into it and try to excel myself. Thank you once again.
13 years ago

Campbell Ritchie wrote:Why are you still using StringTokenizer?

You need some debugging information. Get rid of the tokenising for the time being (comment it out), and print each line as you read it.
Why are you reusing the file name to read into? Why haven't you got a separate local for the String read?



Thank you campbell for your imput. I am new to Java and trying to get into phase. I will look more into string methods available and move forward.
13 years ago

Mohamed Sanaulla wrote:

Srikanth Ravuri wrote:

I don't want the 1st line i.e. ID FNAME LNAME DEPTID. Thats where I am stuck.



In that case- You just have to do-

But suggestion is to use the libraries suggested by Rob. I also mentioned a small glitch in the code in my first post. Also Campbell suggested not using StringTokenizer- You can achieve it by using the split() method of the String class.



Thank you Mohamed

I will keep your inputs in mind and proceed for the next time.
13 years ago

Srikanth Ravuri wrote:

Sreelatha Sankaranarayanan wrote:This is what will help what you want , note the first 2 lines after the while loop starts -----------



I am missing in between lines

Output

101 XXXXXX XXXXX 1
103 XXXXXX XXXXX 2
105 XXXXXX XXXXX 3


missing 102 and 104.....





I am sorry. It is perfect.

Thank you,
13 years ago

Mohamed Sanaulla wrote:

Prakash Krsihnan wrote:Inside while check for linenumber is zero then ignore the operation, else proceed as usuals



In the code- linenumber is used only at two places-To declare and to increment. It doesn't really affect the CSV parsing process.




This is my output when I execute my program

ID FNAME LNAME DEPTID
106 XXXX XXXX 1
107 XXXX XXXX 2
108 XXXX XXXX 2
109 XXXX XXXX 3
110 XXXX XXXX 3


I don't want the 1st line i.e. ID FNAME LNAME DEPTID. Thats where I am stuck.
13 years ago

Sreelatha Sankaranarayanan wrote:This is what will help what you want , note the first 2 lines after the while loop starts -----------



I am missing in between lines

Output

101 XXXXXX XXXXX 1
103 XXXXXX XXXXX 2
105 XXXXXX XXXXX 3


missing 102 and 104.....
13 years ago

Prakash Krsihnan wrote:Inside while check for linenumber is zero then ignore the operation, else proceed as usuals



I didn't quit get your point. can you please brief it more.

Thank you,
13 years ago
Hi

I want to extract data from .csv file eliminating the 1st line. I tried to put code any number of fashion but couldn't make it happen. Any suggestion on where I been wrong.

Here is my code.




As well I want to insert the data extracted from .csv file into my SQL table. Any suggestion on it. I taught of inputing by reading each element as an array or by reading it as a readLine method.

Thank you,
13 years ago

Anand Bhatt wrote:You are on track now:

This error is thrown if a user wants to log on a database but lacks the create session system privilege.
In order to give someone this privilege, use:
grant create session to the_user;



Thanks Anand for quick response.

I have a new problem now. I can print 1st row of the data and the rest it stops with an error message





Here is my new java code.




Any comments or suggestions on where I went wrong.

Thank you,

Tom Reilly wrote:Actually, it's:
1. Right click on the project
2. Select Properties
3. Select Java Build Path
4. Select the Libraries tab
5. Click the Add External JARs button
6. Navigate to, and select classes12.jar



Thank you Tom

I got hold up with DB connectivity error saying:


any suggestion at to keep me on a right track.

Thank you

Anand Bhatt wrote:Do you have classes12.jar file in your application path?



Thanks Anand for the reply.

I am new to java. I am using eclipse to call the stored procedures. As you said I downloaded classes12.jar file and uploaded my java lib folder and still I couldn't see that on eclipse. Any suggestion of where I am doing the mistake.

Please help.

Thank you,
Hi

I am new to java. I am trying to call data from Oracle using java code but got few errors. Can you please help me where I am going wrong.

Thanks in advance.

Code:





Error:

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.srikanth.bank.dao.EmpDAO.main(EmpDAO.java:19)
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin @localhost:1521:XE
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.srikanth.bank.dao.EmpDAO.main(EmpDAO.java:29)



Please help me where I am going wrong.