Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Tuesday, March 6, 2012

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt?

Our program report the error like this:

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

How does this error happen?

How can I fix it?

We use the SqlServer 2005.

Thanks

This occurs when you issue a new query before you've finished consuming the results from your previous query. Most often people are trying to issue subqueries when a JOIN statement in the original would suffice. Otherwise, you can use a different connection to make the subquery or look into MARS (multiple active result sets) for SQL Server 2005.

I don't think this is SSIS-related and should be moved to a different forum.
|||

I have never used ODBC SQL server driver from within SSIS ; I always use either SQL server ole db or .NET provider SQL client data provider.

have you tried one of these yet?

|||

the operation occours this error is just a [update] sentence.

Does this error can be caused by mutil-thread or other reasons?

Thanks a lot

|||I used vc++ and ADO.|||vc++ and ado , then this is probably not SSIS related, you should look in another forum or newsgroup.

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

Our program report the error like this:

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

I used VC++ and ADO.

How does this error happen?

How can I fix it?

Does this can be caused by mutil-thread?

We use the SqlServer 2005.

Thanks

This is caused by you have a opening result set open against the same connection. For example, you execute a SqlCommand to select all rows from a table, while the result set is not drained, you try to execute another SqlCommand using the same connection, you will hit this error message.

To solve this, you have two choices:

a. Make sure you read the rest data from the pending result set before you send the next SqlCommand.

b. Use MARS (Multiple Active ResultSet) connection setting to enable multiple active result set in a connection. See http://msdn2.microsoft.com/en-us/library/ms345109.aspx

for more details.

Thanks!

Ping

|||

Refer to MARS, http://msdn2.microsoft.com/en-us/library/ms345109.aspx.

It is seems that the SQL SERVER 2005 has already fixed it, isn't it?

Thanks

|||

If I'm reading your error message correctly, the issue is that you're using a pre-SQL 2005 driver. Although the SQL 2005 Server understand MARS, you'll need to use the SQL 2005 driver in order for your application to be able to use it.

You'll need to connect using the "SQL Server Native Client" driver instead of the "SQL Server" driver.

Hope this helps!

~Warren

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

Our program report the error like this:

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

I used VC++ and ADO.

How does this error happen?

How can I fix it?

Does this can be caused by mutil-thread?

We use the SqlServer 2005.

Thanks

This is caused by you have a opening result set open against the same connection. For example, you execute a SqlCommand to select all rows from a table, while the result set is not drained, you try to execute another SqlCommand using the same connection, you will hit this error message.

To solve this, you have two choices:

a. Make sure you read the rest data from the pending result set before you send the next SqlCommand.

b. Use MARS (Multiple Active ResultSet) connection setting to enable multiple active result set in a connection. See http://msdn2.microsoft.com/en-us/library/ms345109.aspx

for more details.

Thanks!

Ping

|||

Refer to MARS, http://msdn2.microsoft.com/en-us/library/ms345109.aspx.

It is seems that the SQL SERVER 2005 has already fixed it, isn't it?

Thanks

|||

If I'm reading your error message correctly, the issue is that you're using a pre-SQL 2005 driver. Although the SQL 2005 Server understand MARS, you'll need to use the SQL 2005 driver in order for your application to be able to use it.

You'll need to connect using the "SQL Server Native Client" driver instead of the "SQL Server" driver.

Hope this helps!

~Warren

Saturday, February 25, 2012

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

I have a ms sqlserver 2000 database installed on my Windows NT4 PC.

I want to access this database from a java program using JDBC - ODBC

Here are the relavent lines of code from my java source code file.

Note : I am attempting to access the sample database "Northwind Traders" that came with the installation.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
datasource = "NORTHDS";
url = "jdbc:odbc:" + datasource;
con = DriverManager.getConnection(url,username,password) ;
query = "SELECT * from " + datasource + "." + username + "." + tablename;
ResultSet rs = stmt.executeQuery(query);

The connection succeeds but the query fails with :
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid object name 'NORTHDS.username.Customers'.

Using the program "Microsoft Access" I was able to verify that the "Customers" table is intact.

Any ideas ?Take a look at the following:

In your select statement there are a couple of potential problems that you need to verify.

select * from datasource.username.table ... which is returning 'NORTHDS.username.Customers'

should be

select * from Northwind.dbo.Customers ... (unless you renamed the database ...)

In other words, check to make sure your are referencing the correct database/owner/table in your select statement. It appears that the variables you are using are incorrect. tablename appears to be ok, but the username variable is returning username. Also, the datasource variable may not be your database name.

Thursday, February 16, 2012

[AdventureWorks] database backup failed with error: 3013

SQL Server 2005
A couple nights ago I got several failures on my 3 AM database backups, my
program generated the message:
[AdventureWorks] database backup failed with error: 3013
on several databases, including: AdventureWorks, AdventureWorksDW, master,
model & msdb.
The error number was captured using @.@.ERROR.
When I saw the error, I did the following:
- Check drive space. Fine.
- Check Windows Event Log - no pertinant messages (particulary drive
space)
- Check SQL Server logs
BACKUP failed to complete the command BACKUP LOG msdb. Check the
backup application log for details
Error 3041, Severity 16, State 1
(repeats for several databases)
- Ran DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKDB and all were
fine.
- Re-ran a full backup without any issues.
I know I will see error 3013 if I run out of space on a drive, but that
wasn't the case here.
The only thing "wrong" with this install is that the data and backups are
all on the E: drive and while the drive itself is fragmened, but with only
some minor exceptions, none of the .*df files are in the list.
Oh, and not that I think it matters, but AutoShrink is off on all DB's.
I would appreciate any assistance anyone can give helping me to understand
what may have gone wrong.
Thanks,
Jay
PS. I decided to do some resizing of datafiles and run a defrag.Apparently something changed in the nightly backups so that it is
trying to backup the logs on those databases.
The databases you list all default to SIMPLE recovery mode. The
example you showed for msdb was a failure to backup the log. You can
not backup the log on a database in SIMPLE recovery mode.
Roy Harvey
Beacon Falls, CT
On Wed, 14 Nov 2007 09:40:37 -0800, "Jay" <nospam@.nospam.org> wrote:
>SQL Server 2005
>A couple nights ago I got several failures on my 3 AM database backups, my
>program generated the message:
>[AdventureWorks] database backup failed with error: 3013
>on several databases, including: AdventureWorks, AdventureWorksDW, master,
>model & msdb.
>The error number was captured using @.@.ERROR.
>When I saw the error, I did the following:
> - Check drive space. Fine.
> - Check Windows Event Log - no pertinant messages (particulary drive
>space)
> - Check SQL Server logs
> BACKUP failed to complete the command BACKUP LOG msdb. Check the
>backup application log for details
> Error 3041, Severity 16, State 1
> (repeats for several databases)
> - Ran DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKDB and all were
>fine.
> - Re-ran a full backup without any issues.
>I know I will see error 3013 if I run out of space on a drive, but that
>wasn't the case here.
>The only thing "wrong" with this install is that the data and backups are
>all on the E: drive and while the drive itself is fragmened, but with only
>some minor exceptions, none of the .*df files are in the list.
>Oh, and not that I think it matters, but AutoShrink is off on all DB's.
>I would appreciate any assistance anyone can give helping me to understand
>what may have gone wrong.
>Thanks,
>Jay
>PS. I decided to do some resizing of datafiles and run a defrag.
>|||You are correct sir.
I have been dealing with the difference between 2000 & 2005 on the issue of
backing up the transaction log for simple mode databases and had just
included extra error traps. I also have a version that won't try the simple
mode log backup on version 9.
I supose I just managed to confuse myself.
Thanks,
Jay
"Roy Harvey (SQL Server MVP)" <roy_harvey@.snet.net> wrote in message
news:h4fmj392cv2vmstka6dkk07qfiovlvgsnu@.4ax.com...
> Apparently something changed in the nightly backups so that it is
> trying to backup the logs on those databases.
> The databases you list all default to SIMPLE recovery mode. The
> example you showed for msdb was a failure to backup the log. You can
> not backup the log on a database in SIMPLE recovery mode.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 14 Nov 2007 09:40:37 -0800, "Jay" <nospam@.nospam.org> wrote:
>>SQL Server 2005
>>A couple nights ago I got several failures on my 3 AM database backups, my
>>program generated the message:
>>[AdventureWorks] database backup failed with error: 3013
>>on several databases, including: AdventureWorks, AdventureWorksDW, master,
>>model & msdb.
>>The error number was captured using @.@.ERROR.
>>When I saw the error, I did the following:
>> - Check drive space. Fine.
>> - Check Windows Event Log - no pertinant messages (particulary drive
>>space)
>> - Check SQL Server logs
>> BACKUP failed to complete the command BACKUP LOG msdb. Check
>> the
>>backup application log for details
>> Error 3041, Severity 16, State 1
>> (repeats for several databases)
>> - Ran DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKDB and all were
>>fine.
>> - Re-ran a full backup without any issues.
>>I know I will see error 3013 if I run out of space on a drive, but that
>>wasn't the case here.
>>The only thing "wrong" with this install is that the data and backups are
>>all on the E: drive and while the drive itself is fragmened, but with only
>>some minor exceptions, none of the .*df files are in the list.
>>Oh, and not that I think it matters, but AutoShrink is off on all DB's.
>>I would appreciate any assistance anyone can give helping me to understand
>>what may have gone wrong.
>>Thanks,
>>Jay
>>PS. I decided to do some resizing of datafiles and run a defrag.|||To add to Roy's comments, I would recommend not backing up the
AdventureWorks sample databases at all. You can always reinstall or download
these later if you need to.
--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
Download the latest version of Books Online from
http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
"Jay" <nospam@.nospam.org> wrote in message
news:%238yk4VuJIHA.6108@.TK2MSFTNGP03.phx.gbl...
> SQL Server 2005
> A couple nights ago I got several failures on my 3 AM database backups, my
> program generated the message:
> [AdventureWorks] database backup failed with error: 3013
> on several databases, including: AdventureWorks, AdventureWorksDW, master,
> model & msdb.
> The error number was captured using @.@.ERROR.
> When I saw the error, I did the following:
> - Check drive space. Fine.
> - Check Windows Event Log - no pertinant messages (particulary drive
> space)
> - Check SQL Server logs
> BACKUP failed to complete the command BACKUP LOG msdb. Check
> the backup application log for details
> Error 3041, Severity 16, State 1
> (repeats for several databases)
> - Ran DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKDB and all were
> fine.
> - Re-ran a full backup without any issues.
> I know I will see error 3013 if I run out of space on a drive, but that
> wasn't the case here.
> The only thing "wrong" with this install is that the data and backups are
> all on the E: drive and while the drive itself is fragmened, but with only
> some minor exceptions, none of the .*df files are in the list.
> Oh, and not that I think it matters, but AutoShrink is off on all DB's.
> I would appreciate any assistance anyone can give helping me to understand
> what may have gone wrong.
> Thanks,
> Jay
> PS. I decided to do some resizing of datafiles and run a defrag.
>|||Thanks, but no thanks. All databases get backed up.
Besides, I activly monitor these systems, so I'll know if space is an issue
before it becomes an issue.
"Gail Erickson [MS]" <gaile@.online.microsoft.com> wrote in message
news:%23m8HfIvJIHA.3820@.TK2MSFTNGP03.phx.gbl...
> To add to Roy's comments, I would recommend not backing up the
> AdventureWorks sample databases at all. You can always reinstall or
> download these later if you need to.
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
> Download the latest version of Books Online from
> http://technet.microsoft.com/en-us/sqlserver/bb428874.aspx
> "Jay" <nospam@.nospam.org> wrote in message
> news:%238yk4VuJIHA.6108@.TK2MSFTNGP03.phx.gbl...
>> SQL Server 2005
>> A couple nights ago I got several failures on my 3 AM database backups,
>> my program generated the message:
>> [AdventureWorks] database backup failed with error: 3013
>> on several databases, including: AdventureWorks, AdventureWorksDW,
>> master, model & msdb.
>> The error number was captured using @.@.ERROR.
>> When I saw the error, I did the following:
>> - Check drive space. Fine.
>> - Check Windows Event Log - no pertinant messages (particulary drive
>> space)
>> - Check SQL Server logs
>> BACKUP failed to complete the command BACKUP LOG msdb. Check
>> the backup application log for details
>> Error 3041, Severity 16, State 1
>> (repeats for several databases)
>> - Ran DBCC CHECKALLOC, DBCC CHECKCATALOG, DBCC CHECKDB and all were
>> fine.
>> - Re-ran a full backup without any issues.
>> I know I will see error 3013 if I run out of space on a drive, but that
>> wasn't the case here.
>> The only thing "wrong" with this install is that the data and backups are
>> all on the E: drive and while the drive itself is fragmened, but with
>> only some minor exceptions, none of the .*df files are in the list.
>> Oh, and not that I think it matters, but AutoShrink is off on all DB's.
>> I would appreciate any assistance anyone can give helping me to
>> understand what may have gone wrong.
>> Thanks,
>> Jay
>> PS. I decided to do some resizing of datafiles and run a defrag.
>

Monday, February 13, 2012

[?]Restore and Backup problem

I've a program with VB6 working with SQLServer 2000.
I have a Central Station with the program runnin with full prvileges and
that can perform all the actions on the DB.
There are also some clients that cannot be connected via LAN or internet
that need to use the same DB.
The way I solved this with Aces was to copy the Access file from the Central
Station ot the disconnected clients.
Then to update the central Staton I used to save the recordset of new data
entered from there onto files and then copy them into the Central Station.
Now I'm upgrading the program to run with SQLServer.
I can do everything but the Backup and restore of the DB.
Actually I perform the DB Backup to file with the command line

BACKUP DATABASE myDB TO DISK = 'TempFileName.bak'

This way I can save the file on a USB key or send it via email

Then I restore it on the disconnected clients using the command line

RESTORE DATABASE myDB FROM DISK ='TempFileName.bak' WITH REPLACE

Everything looks fine and seems to work, but on my testing machine I'm
having this strange behavior:

I create new datas into the DataBase, then I execute the backup and quit the
application.
I open EM and delete the just entered datas
I open the application simulating the disconnected clinet (just a string
option, the program is the same)
I execute the RESTORE
I expect hte cancelled datas to be back online, but...... the cancelled
datas is not restored.
I then open EM and execute a backup from the file I created with Backup and
..... the data goes in.
Why?
Is the problem raised only becouse the SQLServer is the same in both cases?

What I need is just to copy one DB and inserting it into a different Server.
Any idea why this is appening?
Any idea on how to do this operation?

I tryed already the RECOVERY, NORECOVERY and quite everything, but ......

Thanks in advance for your helpPerhaps you are inadvertently appending to the backup file instead of
overwriting. Try

BACKUP DATABASE myDB TO DISK = 'TempFileName.bak' WITH INIT

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Spieg" <spiegator@.tiscali.it> wrote in message
news:WgQUc.120173$OR2.6141961@.news3.tin.it...
> I've a program with VB6 working with SQLServer 2000.
> I have a Central Station with the program runnin with full prvileges and
> that can perform all the actions on the DB.
> There are also some clients that cannot be connected via LAN or internet
> that need to use the same DB.
> The way I solved this with Aces was to copy the Access file from the
Central
> Station ot the disconnected clients.
> Then to update the central Staton I used to save the recordset of new data
> entered from there onto files and then copy them into the Central Station.
> Now I'm upgrading the program to run with SQLServer.
> I can do everything but the Backup and restore of the DB.
> Actually I perform the DB Backup to file with the command line
> BACKUP DATABASE myDB TO DISK = 'TempFileName.bak'
> This way I can save the file on a USB key or send it via email
> Then I restore it on the disconnected clients using the command line
> RESTORE DATABASE myDB FROM DISK ='TempFileName.bak' WITH REPLACE
> Everything looks fine and seems to work, but on my testing machine I'm
> having this strange behavior:
> I create new datas into the DataBase, then I execute the backup and quit
the
> application.
> I open EM and delete the just entered datas
> I open the application simulating the disconnected clinet (just a string
> option, the program is the same)
> I execute the RESTORE
> I expect hte cancelled datas to be back online, but...... the cancelled
> datas is not restored.
> I then open EM and execute a backup from the file I created with Backup
and
> .... the data goes in.
> Why?
> Is the problem raised only becouse the SQLServer is the same in both
cases?
> What I need is just to copy one DB and inserting it into a different
Server.
> Any idea why this is appening?
> Any idea on how to do this operation?
> I tryed already the RECOVERY, NORECOVERY and quite everything, but ......
> Thanks in advance for your help|||Right, the WITH INIT Worked, damn I read it, but ...
Thanks

"Dan Guzman" <danguzman@.nospam-earthlink.net> ha scritto nel messaggio
news:c3UUc.6485$3O3.6087@.newsread2.news.pas.earthl ink.net...
> Perhaps you are inadvertently appending to the backup file instead of
> overwriting. Try
> BACKUP DATABASE myDB TO DISK = 'TempFileName.bak' WITH INIT
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP