File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes jdbc with mssql noob issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jdbc with mssql noob issue" Watch "jdbc with mssql noob issue" New topic
Author

jdbc with mssql noob issue

thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 118


hey guys the line st.executeUpdate(table); seems to take control to the catch block..i am new to try catch too...what is my mistake please guide me


on job hunt
Sumit Patil
Ranch Hand

Joined: May 25, 2009
Posts: 296

Can you post the error message you are getting?
Also, try putting a catch block with SQLException before the catch block you have given.


Thanks & Regards, Sumeet
SCJP 1.4, SCWCD 5, LinkedIn Profile
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Please change this part of your code:

Into something more useful:

So that at least you have a clue about what goes wrong - just the word "error" isn't going to tell you very much.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 118
Sorry for completely editing this post I had pasted the wrong code here.hey the e.stacktrace() pointed out the error. it says that the table already exists..so the problem occurs when i try to create the same table again right?
thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 118
Thank you jesper your advice worked.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

thejwal pavithran wrote:Sorry for completely editing this post I had pasted the wrong code here.hey the e.stacktrace() pointed out the error. it says that the table already exists..so the problem occurs when i try to create the same table again right?


You should use:

DROP TABLE IF EXISTS

or

CREATE TABLE IF NOT EXISTS


PM Me If You Want to get Urgent Help on Java Programming
thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 118
Nam Ha Minh wrote:
thejwal pavithran wrote:Sorry for completely editing this post I had pasted the wrong code here.hey the e.stacktrace() pointed out the error. it says that the table already exists..so the problem occurs when i try to create the same table again right?


You should use:

DROP TABLE IF EXISTS

or

CREATE TABLE IF NOT EXISTS


yes i will try that soon..thanks for your point
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc with mssql noob issue