Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uploading excel sheet to Database

 
Krish Khan
Ranch Hand
Posts: 46
  • 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: 20529
54
Chrome Eclipse IDE Java Windows
  • 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
  • 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: 20529
54
Chrome Eclipse IDE Java Windows
  • 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
  • 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: 34410
346
Eclipse IDE Java VI Editor
  • 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: 34410
346
Eclipse IDE Java VI Editor
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic