aspose file tools
The moose likes Beginning Java and the fly likes jdbc with mssql noob issue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 113


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
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

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: 113
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: 113
Thank you jesper your advice worked.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 346

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


Hiring Java developers
thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 113
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: jdbc with mssql noob issue
 
Similar Threads
help with another exception
ResultSet object returning null
jdbc program written in Eclipse3.2.1 to connect DB2
LOAD DATA INFILE problem
jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"