| Author |
Uploading excel sheet to Database
|
Krish Khan
Ranch Hand
Joined: Dec 14, 2009
Posts: 46
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Krish Khan
Ranch Hand
Joined: Dec 14, 2009
Posts: 46
|
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Well, what's the problem now?
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
Maybe you should look at the java.sql.Blob datatype...
http://msdn.microsoft.com/en-us/library/ms378813.aspx
|
Regards, Rene Larsen
Dropbox Invite
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
|
I've added code tags to your post and am moving it to our JDBC forum.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
|
content.toString() isn't going to work for a CLOB/BLOB. You need to use a PreparedStatement with "?" binding variables.
|
 |
 |
|
|
subject: Uploading excel sheet to Database
|
|
|