Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: SQLServer Stored Proc. not working as intented

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SQLServer Stored Proc. not working as intented

    Hallo all!
    first post here as I wasn't able to find any suitable answers in the internet..

    a part of my project connects to an SQL Server db and executes a Stored Procedure.
    This Procedure fills some tables with data retrieved from an xml file.

    so..the problem...

    - When I execute it for a small xml it's working great.
    - When I execute it for a large xml file:
    * It's working as intented when I execute it via sql server directly
    * but it's NOT working when I execute it via my project (although it returns a "successful" message).

    So...my procedure is correct and any errors are encountered in my java code listed below...any ideas?

     
    public static void bulkInsertXml(boolean showMessages){
    		  String urlSQLS = "";
     
    		  try{
                            //retrieve data from configuration file
    			java.util.Properties vProp = new java.util.Properties();
    		        java.io.FileInputStream iFile = new java.io.FileInputStream("parser.config");
     
    		        vProp.loadFromXML(iFile);
    		        urlSQLS = vProp.getProperty("SQLS");		        
    			}
    			catch(Exception ex)
    			{		
    			}
    		  try {
    			  Connection conn = DriverManager.getConnection(urlSQLS);			
    			  Statement stmt = conn.createStatement();
    			  boolean rs;
     
    			  rs = stmt.execute("exec MISCardLink_DEV.dbo.CIF_bulk_insert 1");
    			  if (!rs){
    				   if (showMessages)
    				  	System.out.println("Bulk Insert Succeeded");
    			  }
    			  else{
    				  if (showMessages)
    				  	System.out.println("Bulk Insert Failed");
    		  	  }
    			  conn.close();
    		  }catch (Exception e) {
    	            System.err.println("Got an exception! ");
    	            System.err.println(e.getMessage());
    	            e.printStackTrace();	            
    		  }
    	  }

    thanx for your time!


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,308
    Thanks
    181
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: SQLServer Stored Proc. not working as intented

    catch(Exception ex)
    			{		
    			}

    May or may not pinpoint the problem, but never ignore exceptions such as this.

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: SQLServer Stored Proc. not working as intented

    I left that spot to fill with log4j messages...which I did yesterday.

    Still have the same issue though. Checked querry and connection timeout as well to no avail.
    Any ideas?
    Every thought on the subject will be very appreciated!

Similar Threads

  1. How to download a pdf file stored in a MySQL blob?
    By A4Andy in forum JDBC & Databases
    Replies: 1
    Last Post: October 20th, 2011, 11:35 PM
  2. issue in executing Stored Proc
    By Bhawesh Kurmi in forum JDBC & Databases
    Replies: 1
    Last Post: December 8th, 2010, 09:05 AM
  3. [SOLVED] SQLServer Hell
    By xyrer in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 21st, 2010, 04:46 PM
  4. Is it possible to export Stored Procedures using JDBC?
    By sid7 in forum JDBC & Databases
    Replies: 0
    Last Post: August 28th, 2010, 05:34 PM
  5. Value Not Being Stored
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 0
    Last Post: August 16th, 2010, 09:38 AM