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

jdbc with mssql noob issue

 
thejwal pavithran
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the error message you are getting?
Also, try putting a catch block with SQLException before the catch block you have given.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
thejwal pavithran
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you jesper your advice worked.
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
thejwal pavithran
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic