Showing posts with label fails. Show all posts
Showing posts with label fails. Show all posts

Saturday, February 11, 2012

"dbuse" fails when database name is larger than 28 characters

Hi,

We have troubles when we try to use the 'dbuse' calls with databases
larger than 28 characters, looks like the dbuse truncates the name
after it.

Any ideas ?[posted and mailed, please reply in news]

Eyal Goren (eyal_goren@.bmc.com) writes:
> We have troubles when we try to use the 'dbuse' calls with databases
> larger than 28 characters, looks like the dbuse truncates the name
> after it.

Are you really sure that it is 28? I would expect the limit to be 30,
and testing confirms that.

DB-Library is a client library that Microsoft has deprecated and has
not developed since the relase of SQL Server 6.5. This means that you
do not have support for features added in SQL 7 or later. In 6.5 the
maximum length of an object name (database, table, stored procedure etc)
was 30 characters. This was increased to 127 characters in SQL7. However
DB-Library does not know about this and truncates after 30 chars.

In this particular case there is a fairly simple workaround: use dbcmd
and dbsqlexec to pass a USE command instead.

For the long term, I would recommend that you plan for migrating your
DB-library apps to some other client library.

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

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

Thanks for the workaround, it seems to work.

Just one small question:

I added the following code-

r = dbcmd (login_rec->dbproc, command);
if (r == SUCCEED) r = dbsqlexec (login_rec->dbproc);

dbcancel (login_rec->dbproc);

I added the dbcancel to clear the buffer, is that O.K. for this purpose ?

Thanks
Eyal|||Eyal Goren (eyal_goren@.bmc.com) writes:
> Thanks for the workaround, it seems to work.
> Just one small question:
> I added the following code-
> r = dbcmd (login_rec->dbproc, command);
> if (r == SUCCEED) r = dbsqlexec (login_rec->dbproc);
>
> dbcancel (login_rec->dbproc);
> I added the dbcancel to clear the buffer, is that O.K. for this purpose
> ?

I can't see that there could be any problems in this case. But personally
I would have done the regular dbresults() loop instead. I've seen ugly
things happen with canceling queries.

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns94ED6DB081AE7Yazorman@.127.0.0.1>...
> Eyal Goren (eyal_goren@.bmc.com) writes:
> > Thanks for the workaround, it seems to work.
> > Just one small question:
> > I added the following code-
> > r = dbcmd (login_rec->dbproc, command);
> > if (r == SUCCEED) r = dbsqlexec (login_rec->dbproc);
> > dbcancel (login_rec->dbproc);
> > I added the dbcancel to clear the buffer, is that O.K. for this purpose
> > ?
> I can't see that there could be any problems in this case. But personally
> I would have done the regular dbresults() loop instead. I've seen ugly
> things happen with canceling queries.

Thanks for your help!!!

"Data Source=localhost;..." fails with : General network error.

I replaced SQL 2000 with SQL 2005 Developer edition and my application could
not connect
to the local SQL server anymore. When connecting from a .Net 1.1 application
using the
following connection string:
"Data Source=localhost;Database=MM;Integrated Security=SSPI"
I always received the following exception message:
"General network error. Check your network documentation."
I had no problem to connect when using the host name instead of "localhost".
The problem
got resolved when I started "SQL Server Surface Area Configuration" and conf
igured it as
follow:
Surface Area Configuration for Services and Connections -> Database Engine -
> Remote
Connections -> Local and remote connections -> Using TCP/IP only.
The SQL 2005 Developer Edition is configured out of the box with "Local conn
ections only"
and "localhost" for some reason is not recognized as a local connection !!!!Try . or (local) or servername or IP address.
"Gaetan" <someone@.somewhere.com> wrote in message
news:14fhn1dr367kni9qt8vp7j5rb70imtelhl@.
4ax.com...
>I replaced SQL 2000 with SQL 2005 Developer edition and my application
>could not connect
> to the local SQL server anymore. When connecting from a .Net 1.1
> application using the
> following connection string:
> "Data Source=localhost;Database=MM;Integrated Security=SSPI"
> I always received the following exception message:
> "General network error. Check your network documentation."
> I had no problem to connect when using the host name instead of
> "localhost". The problem
> got resolved when I started "SQL Server Surface Area Configuration" and
> configured it as
> follow:
> Surface Area Configuration for Services and Connections -> Database
> Engine -> Remote
> Connections -> Local and remote connections -> Using TCP/IP only.
> The SQL 2005 Developer Edition is configured out of the box with "Local
> connections only"
> and "localhost" for some reason is not recognized as a local connection
> !!!!
>