*
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 Android Security Essentials Live Lessons this week in the Android 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: 117


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: 14074
    
  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: 117
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: 117
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: 117
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
 
Similar Threads
jdbc program written in Eclipse3.2.1 to connect DB2
ResultSet object returning null
help with another exception
jdbc programm connecting DB2, error thrown in cmd as "null user id is not supported"
LOAD DATA INFILE problem