File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uploading excel sheet to Database

 
Krish Khan
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,

I am using IDE netbeans, sql 2008 as data base .

Now i tried to create a java application and written the following code :





I created a datasource dsn as mydsn and cinfigured with Microsoft Excel.


when i tried to run i got the follwoing error:

run:
Error: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
BUILD SUCCESSFUL (total time: 0 seconds)


PLease help me. as i am starter. thank You
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) UseCodeTags. You can edit your post to add them.

2) the message is quite clear - the SQL driver class cannot be found. You need to add sqljdbc.jar to your class path.
 
Krish Khan
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah thank i have already added that jar file. Now can you correct my code. I am unable to imoprt excel to sql database.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, what's the problem now?
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you should look at the java.sql.Blob datatype...

http://msdn.microsoft.com/en-us/library/ms378813.aspx
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33684
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've added code tags to your post and am moving it to our JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33684
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
content.toString() isn't going to work for a CLOB/BLOB. You need to use a PreparedStatement with "?" binding variables.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic