Sqljdbc Exception While Execute Batch Statement (Seems BUG)

Mar 17, 2008

The following exception is thrown with sqljdbc.jar (not with jtds0.9.jar)

com.microsoft.sqlserver.jdbc.SQLServerException: New request is not allowed to start because it should come with valid transaction descriptor.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(Unknown Source)
at org.apache.commons.dbcp.DelegatingConnection.rollback(DelegatingConnection.java:265)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.rollback(PoolingDataSource.java:288)


While using the query :


if not exists ( select 1 from sysindexes where id = object_id('aaa') and name = 'aaa_pk')create unique nonclustered index aaa_pkon aaa(id)using Statement.executeBatch()at conection.commit()

Sample Code

conn = getConnection();

// create the statement and execute the query
Statement stmt = null;
try
{
conn.setAutoCommit(false);
stmt = conn.createStatement();
for ( String sql : sqlList )
{
stmt.addBatch( sql );
}

results = stmt.executeBatch();
stmt.clearBatch();
conn.commit(); //throws the exception
}
catch ( SQLException e )
{
try
{
conn.rollback();
}
catch ( SQLException e1 )
{
throw new DataSourceException( e1 );
}
throw new DataSourceException( "Error executing sql: %1", e, sqlList.toString() );
}

View 1 Replies


ADVERTISEMENT

Strange Exception - Batch Update

Apr 19, 2007

Can anyone help me understand what this means:




Code Snippet

java.sql.BatchUpdateException: com.microsoft.sqlserver.jdbc.SQLServerException: The IOBuffer.process operation returned an unknown packet type:0. Index:41. End:83.TDS_DONEINPROC(-1) TDS_DONEPROC(-2) TDS_DONE(-3) TDS_COLMETADATA(-127)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source)




I'm trying to do a very simple batch update.

View 7 Replies View Related

Batch Does Not Execute

Apr 30, 2008

Hi

I'm running into an odd problem. I have set a backup process on a user installation, and invoke the backup using a CMD file.

When the CMD file is executed from a DOS box, or windows GUI the SQLCMD executes, but, when the same batch file gets spawned by the AT command, the SQLCMD does not exeute.

The odd part is that I have the same exact setup on another SQL Express installation on another server and it works OK.

Ideas?

David L.

View 8 Replies View Related

Execute Batch File

Mar 31, 2000

Hi,
I would like to ask someone who could help me with one small problem:

I would like to run SQL server task on one of my servers, that will connect
to all other servers (including ones that are not SQL servers, ie: Exchange,
Test Server etc) one at the time, and that will execute one batch file (update.bat) that is residing on each server under C: drive.

Batch file will copy some things from all of the servers to one server.

Thanks, in advance.

Regards,
Vilko

View 1 Replies View Related

Execute Batch File As Sql Job

Apr 5, 2006

I'm trying schedule a batch file to run as a job from sql server agent. The batch file copies files from one server directory to a directory on another server. The batch file works properly when executed directly. The job is being executed under the sql service account login. I've given the service account access to both the source and destination directories.

When I try to run the job it fails with an "Access is denied" error on both the source and destination directories (as read from job history).

Any ideas?

View 4 Replies View Related

Execute A Batch File

Jul 25, 2007

Hi All,
I would like to embed some stored procedures in a batch file and execute it from the command prompt on windows.
I have no idea of how to embed a stored proc in a .bat file.
Can you please redirect me to the solution to this?

Thanks in advance
vishu

View 1 Replies View Related

Using Sql To Execute A Batch File

Aug 9, 2007

Is it possible to use sql to execute a batch file? I would like toexecute the following "C:BTWartend.exe /f=C:BTWToolboxFormatscarnum.btw /p", 6Thanks,Matt

View 6 Replies View Related

EXECUTE AS , Fatal Exception

Oct 11, 2006

Hi There

If i add a new sysadmin login and that login is a user in a DB. If i execute the command EXECUTE AS 'LoginName':

I get the following error:

SqlDumpExceptionHandler: Process 57 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process

WHats up with this?

If my dbo for this db is linked to a sysadmin login i have no problem with EXECUTE as 'dbo'.

WHy do i get fatal errors when trying to execute as a a login name that is sysadmin?

On the net all referencing to the fatal error have nothing to do with EXECUTE AS?

Thanx

View 7 Replies View Related

Execute A Batch File From Within Sql Server

Jul 25, 2001

Hi, and thanks for your help. I have created a simple batch that xcopy files from one directory to another shared directory (in another server). Here is the code:
xcopy c:OUT_TRANSIT E:BACKUP_CESWEB /y

the E:BACKUP_CESWEB is in another server where I mapped the BACKP_CESWEB folder and make it shared.

the location of the batch file is in c:code .
When I double click the batch, the files are moved into E:BACKUP_CESWEB But when I use the window 2000 schedule or try to run the batch code from within sql server analyser, I get no results.

Any idea how to solve this.
The bottom line is that I want to copy files from one server to another server.Thanks for your help

Ali

View 5 Replies View Related

How To Execute SQL Scripts Using Batch File?

Oct 10, 2007

Hi,How can we execute SQL Scripts using Batch file???i think Batch file should contain Username,Password,Database andScripts...Using that file scripts should run...How can i give UserName,Password,Database and all those things?Plz send me details how to do that...if possible with example...Thanx in advance,RR...

View 2 Replies View Related

Execute Stored Procedure Via Batch File

Jan 20, 2012

I have a stored procedure that generates some data and dumps it into a table. I need to export data using bcp based on the data that this procedure creates. So I know how to use bcp but don't know how to execute the procedure and pass it the two variables that it needs. I googled it and sqlcmd looks promising but can get the syntax right. The two variables are the current year and school number ie. 1112, 0021.

View 3 Replies View Related

SQL Server 2008 :: How To Execute Scripts In Batch

Apr 8, 2015

I have separate scripts for Creation of Tables, Stored Procedures, Views, Triggers in different .sql files.

I have to execute thses scripts in batch in different servers and different databases without opening SSMS.

All .sql files to be executed in single command.

View 3 Replies View Related

Script / Batch For Import - How To Execute String

Jun 26, 2014

I am running a SQL Server 2012 Express.

Due that I dont have SSIS and can not plan tasks. So I have to write a script to do the following:

1. Delete Data in Database1 - Table1 on Server 1, Database1 - Table2 on Server 1,Database1 - Table3 on Server 1

2. Delete Data in Database2 - Table1 on Server 1, Database2 - Table2 on Server 1,Database2 - Table3 on Server 1

3. Connect to Server 2

4.Copy Data from Database1 - Table1 on Server 2 to Database1 - Table1 on Server 1 ... and so on

5.Send me a message @xy.com when a error appears

Then I have to run the batch file every day from monday to friday night.

My main problem is the part with the connection. Iam able to write the connection string but I dont know how to execute the string.

View 3 Replies View Related

How To Execute A Batch File Using SQL Server 2005?

Dec 23, 2005

Hi all,As the topic describes, I'd like to run a batch file using sql server.How do i do it?Thanks in advance

View 1 Replies View Related

How Do I Execute A Batch File From Sqlserver 2000 T-sql?

Nov 6, 2007

I tried the following but file dir.rpt is never created. in fact, the exec statement appears to lock-up forever.


exec xp_cmdshell 'c: empjunkdir.bat'


dir.bat Contains
dir c: > c: empjunkdir.rpt

This should be easy!

View 3 Replies View Related

Ugrent Help: How To Write Code To Execute A Batch File

Apr 15, 1999

hi, I need to run a batch file in specific time of the week. can anyone show me the code to run a batch file with both ways: window nt schedualer and ms sql server task manger.... I do appreciate your help

Ali

View 5 Replies View Related

%1 Is Not A Valid Win32 Application - Trying To Execute A Batch File

Feb 12, 2008

Today I ran into the error (see title of this post) while trying to execute a batch file using SSIS. If anyone else runs into this problem I want to point them to my post on the issue, as I did not easily find a solution when doing the search myself: http://blog.lyalin.com/2008/02/1-is-not-valid-win32-application-ssis.html

Summary (So you dont need to visit my blog):

I was trying to execute a totally empty placeholder batchfile and this produces the "%1 is not a valid win32 application" error when using Execute Process Task. Simply add something to your placeholder file (like DIR command) and you can continue running your package without error

I hope this saves someone time in the future.


Comments? If anything in my post is inaccurate I hope you guys post some corrections.

Regards,

Dmitry
http://blog.lyalin.com

View 1 Replies View Related

Executing A Batch Script From Execute Process Task

Aug 22, 2006

Hello,

I have an "execute process" task which executes a perl script. When I run the task, it shows a prompt with the message "the publisher can not be verified". It gives the option to continue the task or to cancel.

The problem for me is that I want to schedule this package to run automatically, and I don't want the automated process to show this dialog. I need to override the security setting and have SSIS execute my batch scripts without prompting. Assuming I don't want to rewrite the Perl code into a script task, is there a way to do acomplish this?

Thanks!

Arkadiy

View 2 Replies View Related

Execute Command Process - Remote Batch File?

Feb 23, 2006

Good afternoon-

Can a batch file that resides on another server be executed from a different machine? I have a batch file that resides on a server that I would like to run using SQL 2005 Integration Services. Is there anything I can do that would allow me to remotely execute this batch file and have it run in that environment.

BATCH FILE:

cd C:Trandev
otrun -at OTRecogn.att -DINPUT_FILE=%1 -tl 1 -cs dv -lg mylog -I
C:Trandev represents the remote environment


I have tried mapping the remote machine to a network drive on my local machine and using that drive to execute the batch file in an Execute Process Task, but it does not work.

SSIS:

I have a FOR EACH loop grabbing files and writing fileName to a variable that is passed to the Process Task as an argument through an expression(%1 in the batch file above). The Working Directory is a mapped network drive. The Executable is also a network drive plus batch file name.


Any help would be appreciated.

My computer is a HP Compaq dc7100, 512mb RAM, WindowsXP

View 7 Replies View Related

Suppressing Exception Errors In Execute Process Task

Apr 12, 2008

I have an execute process task that kicks off gzip to uncompress files within a for each loop. We get a LOT of bad files which causes gzip to throw an unexpected EOF error. This gets bubbled up into SSIS as a Win32 unhandled exception error which then throws up the VS JIT Debugger interface. I know what these errors are and do not want to debug. Is there anyway that I can simply ignore the exception and just throw it away?

View 5 Replies View Related

Calling Remote Batch File Using 'Execute Process Task'

Oct 11, 2006

I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A. The batch file uses pgp software and encrypts a file sitting on machine B itself. The reason why my batch file is sitting on machine B, is because the PGP software is on machine B.

If I execute the batch file by itself from machine B, the script runs fine. I refer the same batch file as a UNC path from my package on machine A. But that does not work since the 'Working directory' is still machine A. I can not set machine B's folder as the working dir because it does not accept UNC path. So I say, ok , let me map a path to that UNC location and map it as drive 'Z:'. Certainly if I do so, I will be running the process on machine A and the batch file will look for the pgp software on machine A, and hence fail.

I have tried third party remote batch execution tools (PSEXEC) but have not had success, not because of SSIS limitations, but simply because the PGP executable when run through the PSEXEC tool, does not identify the location of the public keys on machine B and hence gives an encrytion failure.

How do I get the remote batch file to execute such that it executes with its own env? Is there a better remote execution tool I can try or are there any other features of SSIS I can use to get around this issue? I need the results of the batch file and hence do not want to make it an asyncronous process.

Thanks

Sumeet

View 3 Replies View Related

SQL 2012 :: Calling Remote Batch File Using (Execute Process Task)

Jan 7, 2015

I have a remote batch file on machine B that I need to execute using 'Execute process task' control from a package on machine A.

How Can I achieve this....

View 2 Replies View Related

SQL Server 2008 :: Running Batch File To Execute A Stored Procedure

May 11, 2015

I have create a batch file to execute a stored proc to import data.

When I run it from the server (Remote Desktop) it works fine, but if I share the folder and try to run it from my pc, it doesn't do anything. I don't get an error, it just doesn't do anything. My windows user has admin rights in SQL. Why is it not executing from my PC?

View 9 Replies View Related

SQL Server 2008 :: Use Folder Name As Database From Batch File To Execute Files

Jul 17, 2015

I've been struggling with this issue,

1) Test--FolderName (This Test folder name should use as a database name for below sub folders)

a)Create--Sub Foldername
i)create.sql
b)Alter---Sub FolderName
i)Alter.sql
c)Insert---Sub FolderName
i)Insert.sql

[Code] .....

The scripts need to be run in order. So script one needs to run first folder in that sub folders after that next second folders etc..

Is there a way to create a bat file that automatically runs all these scripts, in order against, the databases they need to?

The databases that they need to run against have the name of the database at the beginning of the name of the folder.

View 0 Replies View Related

Fail Execute Process Task Based On Batch File ERRORLEVEL?

Jun 9, 2006

I am new to this, but have scoured the web and not found an answer to my question...

I have an execute process task that runs a simple batch file. When this batch file completes with an ERRORLEVEL greater than 0, I would like the task to fail. I thought this simply meant setting the "FailTaskIfReturnCodeIsNotSuccessValue" property to true, and setting the SuccessValue to 0. However, this does not appear to work.

Even with a simple batch file forcing the errorcode to 1 as follows, the task still completes "successfully".

SET ERRORLEVEL = 1

Any ideas? Thanks!

View 8 Replies View Related

How To Assign Execute Permission To Batch Of Stored Procs To A User/role

Mar 25, 2008

Just wondering if anyone knows of a useful command to assign execute permissions to a batch of stored procs to a user/role. I've got too many stored procs to manually go thru the steps of browsing for them and scrolling thru each one and clicking "execute" for each one.

Also, would like to know if its possible to update a batch of stored procs that begin with a prefix like "spSomething_".

Any info would be helpful! TIA.

View 3 Replies View Related

Run A Batch Of Sql Statement

Sep 26, 2005

Hi There,

I want to able to run a batch of sql statments (execute procedures) in SQl Server at a specific time. Just wondering if there is a method for that.

View 2 Replies View Related

Why The Function And Batch With Same Sql Statement Have Different Performance?

Jan 3, 2008



hi all,

I have a function and batch witch consisted of same sql statement, and they will get the same result. but time they take is different, and produce a little different query plans, another significant difference is the estimated numbers. the function is always slower than the batch.

does anyone know why same sql would produce different query plans performance? how do i can to let the function as fast as the batch?

thanks!

View 6 Replies View Related

CASE Statement Throwing Exception

Feb 26, 2008

I am using Compact Edition 3.5 against the Northwind.sdf database. The following SQL statement throws an error window in Visual Studio 2008 that states "The parameter is incorrect.". This only occurs when I have an input parameter inside the CASE statement.

**********************************************************************************************************
PLEASE DO NOT TELL ME I CAN JUST USE 'WHERE @CompanyName LIKE '%ABB%''
BECAUSE I UNDERSTAND THAT - I WANT TO KNOW WHY THE SYNTAX I HAVE IS
THROWING AN EXCEPTION
**********************************************************************************************************


This throws an exception when input parameter is in the CASE statement:
SELECT [Customer ID]
FROM Customers
WHERE (CASE WHEN @CompanyName LIKE '%ABB%' THEN 1 ELSE 0 END = 1)


This DOES NOT throw an exception (I know they do not get me the same results):

SELECT [Customer ID]
FROM Customers
WHERE (CASE WHEN [Company Name] LIKE '%ABB%' THEN 1 ELSE 0 END = 1)


TIA!

View 6 Replies View Related

Transact SQL :: ALTER Statement Is Not Getting Executed In A Batch

May 7, 2015

I have written the following code:
 
SET NOCOUNT ON
DECLARE @RowCount int; SET @RowCount = 0;
Begin Try
Begin Transaction
--------------------------------------------------------
-----Table Name: AlertsStaticRecord_Archive
-----Column Name: AlertID
--------------------------------------------------------
ALTER TABLE  [AlertsStaticRecord_Archive]  ALTER COLUMN [AlertID] int NOT NULL;

[Code] .....

But, when I execute these batch, I am getting error:

Msg 8111, Level 16, State 1, Line 11
Cannot define PRIMARY KEY constraint on nullable column in table 'AlertsStaticRecord_Archive'.
Msg 1750, Level 16, State 0, Line 11
Could not create constraint. See previous errors.

Because, the first ALTER statement is not getting executed.

View 4 Replies View Related

Create Batch File That Will Run Update Statement And Schedule It To Run?

Oct 7, 2013

Is there a way to create a Batch file that will run an Update Statement and schedule it to run?I've used bcp to extract data to a txt file before, but i'm not sure if an Update can be performed.I'm using SQL Server 2008 R2 Express Edition so i don't have Server Agent available.

View 7 Replies View Related

How To Free Memory Used By Prior Query Statement Within A Batch By TSQL?

Feb 13, 2004

Just Like these:

-- batch start
Select * from someTable --maybe a query which need much res(I/O,cpu,memory)

/*
can I do something here to free res used by prior statement?
*/

select * from someOtherTable
--batch end

The Sqls above are written in a procedure to automating test for some select querys.

View 4 Replies View Related

'((System.Exception)($exception)).Message' Threw An Exception Of Type 'System.NotSupportedException'

Jan 16, 2008

Greetings everyone, I am attempting to build my first application using Microsofts Sql databases. It is a Windows Mobile application so I am using Sql Server Compact 3.5 with Visual Studio 2008 Beta 2. When I try and insert a new row into one of my tables, the app throws the error message shown in the title of this topic.
'((System.Exception)($exception)).Message' threw an exception of type 'System.NotSupportedException'



My table has 4 columns (i have since changed my FavoriteAccount datatype from bit to Integer)
http://i85.photobucket.com/albums/k71/Scionwest/table.jpg

Account type will either be "Checking" or "Savings" when a new row is added, the user will select what they want from a combo box.

Next is a snap shot of my startup form.
http://i85.photobucket.com/albums/k71/Scionwest/form.jpg



Where it says "Favorite Account: None" in the top panel, I am using a link label. When a user clicks "None" it will go to a account creation wizard, and set the first account as it's primary/favorite. As more accounts are added the user can select which will be his/her primary/favorite. For now I am just creating a sample account when the label is clicked in an attempt to get something working. Below is the code used.


private void lnkFavoriteAccount_Click(object sender, EventArgs e)

{

FinancesDataSet.BankAccountRow account = this.financesDataSet.BankAccount.NewBankAccountRow();

account.Name = "MyBank Checking Account";

account.AccountType = "Checking";

account.Balance = Convert.ToDecimal("15.03");

account.FavoriteAccount = 1;//datatype is an integer, I have changed it since I took the screenshot.

financesDataSet.BankAccount.Rows.Add(account);
//The next three lines where added while I was trying to get this to work.
//I don't know if I really need them or not, I receive the error regardless if these are here or not.



this.bankAccountTableAdapter1.Update(financesDataSet);

this.financesDataSet.AcceptChanges();

refreshDatabase();

}


the refreshDatabase() code is here:


private void refreshDatabase()

{

this.bankAccountTableAdapter1.Fill(this.financesDataSet.BankAccount);

//Aquire a count of accounts the user has

int numAccounts = financesDataSet.BankAccount.Count;

//Loop through each account and see which one is the primary.

for (int num = 0; num != numAccounts; num++)

{
//Works ok in frmMain_Load, but when my lnkFavoriteAccount_click calls this, it throws the error.

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

{
//Display the primary account on our home page. User can click the link label & be taken to their account register.

this.lnkFavoriteAccount.Text = this.financesDataSet.BankAccount[num].Name.ToString();

this.lnkFavoriteFunds.Text = this.financesDataSet.BankAccount[num].Balance.ToString();

break;

}

}

}


and my form_load code

private void frmMain_Load(object sender, EventArgs e)

{

refreshDatabase();

}


So, when I click on the lnkFavoriteAccount label, and my new row gets added, the app stops at the following line in my DataSet.Designer

[global:ystem.Diagnostics.DebuggerNonUserCodeAttribute()]

public byte FavoriteAccount {

get {

try {

return ((byte)(this[this.tableBankAccount.FavoriteAccountColumn]));

}

catch (global:ystem.InvalidCastException e) {
//Stops at the following line, this error was caused by 'if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)'

throw new global:ystem.Data.StrongTypingException("The value for column 'FavoriteAccount' in table 'BankAccount' is DBNull.", e);

}

}

set {

this[this.tableBankAccount.FavoriteAccountColumn] = value;

}

}


I have no idea what I am doing wrong, all of the code I used I retreived from Microsofts help documentation included with VS2008. I have tried used my TableAdapter.Insert() method and it still failed when it got to

if (this.financesDataSet.BankAccount[num].FavoriteAccount == 1)

in my refreshDatabase() method it still failed.

When I look, the data has been added into the database, it's just when I try to retreive it now, it bails on me. Am I retreiving the information wrong?

Thanks for any help you guys can offer.

Johnathon

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved