显示标签为“app”的博文。显示所有博文
显示标签为“app”的博文。显示所有博文

2012年3月29日星期四

bcp_exec() Failed

Has anyone had the above error ?

We ahve an app that uses a C++ to bulk insert into a database, and
during the procedure it some times gives us a error "bcp_exec()
Failed"

Any ideas.

Cheers.john (johnboy1973@.hotmail.com) writes:
> Has anyone had the above error ?

Many times!

> We ahve an app that uses a C++ to bulk insert into a database, and
> during the procedure it some times gives us a error "bcp_exec()
> Failed"

But I cannot recall that the error comes alone, but is always preceded
by other error messages which tells you what the problems with the
bulk copy is. The message "bcp_exec() failed" can be about anything.

If you have more error messagee, please share them too. If you don't,
maybe you should review the error handling in your C++ program, so that
it is not swallowing all error messagee but the last one.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Cheers. The c++ app is not handling the error at all well, but
compains occasionally in the event logs of invalid xml.

Cheers|||john (johnboy1973@.hotmail.com) writes:
> Cheers. The c++ app is not handling the error at all well, but
> compains occasionally in the event logs of invalid xml.

Looks like you need to improve the error handling then.

Which client library are you using? Coming from the DB-Library corner,
I assumed that you were using that. But there might be a bcp_exec() in
other libraries too. And DB-Library does not understand XML. Then again
I can't see where XML comes into the picture with any bulk-load operation.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Its a pain, basically, the app is VB6 connects to com services which
are written in C++, accessed via iis6 .asp page. So it gets the data
it requires from a sql database via a com+ / C++ Dll. Then trys to
pass the result set through bcp.

So im assuming its not the bcp that is at fault but the app pasing the
data too it. So off we go again in a circle.

Thanks for youre input though.

John|||john (johnboy1973@.hotmail.com) writes:
> Its a pain, basically, the app is VB6 connects to com services which
> are written in C++, accessed via iis6 .asp page. So it gets the data
> it requires from a sql database via a com+ / C++ Dll. Then trys to
> pass the result set through bcp.
> So im assuming its not the bcp that is at fault but the app pasing the
> data too it. So off we go again in a circle.

Maybe. But permit me to make the comment that a major reason that I am
not able to give better advice is that I know precious little of your
application. From wnat you describe above, it seems quite complex, and
maybe it's too complex to cover in a newsgroup posting.

But the general rule is: the more precise information you provide, the
more likely it will be that you get a useful answer.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

2012年2月23日星期四

bcp API

I would like to execute bulk copy functionality from a C++ app. Does
an API exist? I have found Bulk-Copy functions (bcp_init,
bcp_exe...) in the ODBC API, is this what I should use? And if yes,
will/is it support by SQL Server version after SQL Server 2000?

Thanks!"elizabeth" <ezelasky@.hotmail.com> wrote in message
news:78393913.0410080650.16eb7a77@.posting.google.c om...
>I would like to execute bulk copy functionality from a C++ app. Does
> an API exist? I have found Bulk-Copy functions (bcp_init,
> bcp_exe...) in the ODBC API, is this what I should use? And if yes,
> will/is it support by SQL Server version after SQL Server 2000?
> Thanks!

Yes - see "Performing Bulk Copy Operations" in Books Online. ODBC is
supported in MSSQL 2005, and the same documentation appears in the latest
available version of the MSSQL 2005 BOL:

http://www.microsoft.com/downloads/...&DisplayLang=en

Simon|||With unmanaged C++ code, you might also consider OLE DB IRowsetFastLoad.
This is what DTS uses.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"elizabeth" <ezelasky@.hotmail.com> wrote in message
news:78393913.0410080650.16eb7a77@.posting.google.c om...
>I would like to execute bulk copy functionality from a C++ app. Does
> an API exist? I have found Bulk-Copy functions (bcp_init,
> bcp_exe...) in the ODBC API, is this what I should use? And if yes,
> will/is it support by SQL Server version after SQL Server 2000?
> Thanks!

2012年2月11日星期六

Basic sql server question...

I'm using SQL Server 2005. Do I need to get Enterprise Manager to administer the app through a hosted server? What do I need if not EM?

Thanks.

You normally manage SQL Server 2005 through the SQL Server Management Studio (SSMS). You can find that on the SQL Server 2005 installation CD, just pick the client components and tools when you install. You can also use the "free" version of SSMS which is used for SQL Server Express, although it has less functionality.

For a remote server, especially one in a datacenter where they don't open many ports, you might find that asking them to open a port just to your machine for a Remote Desktop to be preferrable. You can also use the command line tool (sqlcmd) or even PowerShell to manage your system.

Buck

|||Thanks. Just to clarify - can I use the Express version to remotley administer my application? If I need to get SSMS, can that be downloaded or is it best to order a CD? Thanks again.

2012年2月9日星期四

Basic Security Question for remote app

I'm designing a C# winforms app that will be used by 500 customers/companies. The customers will use the app to edit data for their company on the remote SQL Server. What's the best way to manage security in terms of logins/passwords? Should each user have a different login? (probably not) Or should the application have it's own login/password that is encrypted and the user never knows what the login/password is?

Also, is it necessary to use Web Services for this application? Any other thoughts/comments are very welcome.

If there are 500 DIFFERENT companies, would you want a user for companyA to be able to change information for CompanyB?

If not, then using a common login/permission set is NOT a good idea and individual logins seem necessary. It seems like the question then becomes "How to mangage a large number of logins/permissions?"

Perhaps more details are would be useful to fully understand your scenario...

|||Here's some more detail:

Company Table
CompanyId
CompanyName

ProductTable
ProductId
CompanyId
ProductName
Price

Then, we ship out applications to all the different companies.
The application should know what their CompanyId is. In the C# application, there will be a grid that displays all of the Products for their CompanyId and allows the user to update those products (for example, change the Price for a given product).

At this point, I'm just kind of at a loss for the best way to design this in terms of SQL Server Security and logins/passwords, etc. Hope this is not too vague.
|||

This will prove to be an interesting challenge. I can already imagine some interprising soul for a company 'exploring' the products for other companies -and who knows, even changing prices...

The 'safest' way to control data access (keeping each user to his/her own company) is by knowing what user is attempting data access on each query execution. Without a company specific login (or user specific login), you will have a difficult (perhaps even impossible) time keeping users out of each others data.

Yes, on the surface, the application can appear to take care of it. But are you willing to 'guarantee' all companies that their data is safe from prying eyes and safe from accidental or intentional alteration.

The database 'should' know, with certainity, who (user or company) is accessing data. I think that you have no option but to assign individual logins to each company/user (all users for a company 'could' use the same login).

You will need a process to manage Logins, adding users, resetting lost passwords, disabling or removing users. And a way to map a login to a CompanyID. Once someone logins in, the CompanyID value is supplied to be used in WHERE criteria. I wouldn't accept a CompanyID from the application.

Personally, from the data professional perspective, I wouldn't trust my career to expecting the application to control all access.