Showing posts with label dsn. Show all posts
Showing posts with label dsn. Show all posts

Tuesday, March 20, 2012

Odd issue with bound columns when fetching data.

I'm using ODBC 3.0 in code written in C.

I have an service that connects using a system DSN using the SQL Server 2000 driver. On my development system with SQL Server 2005 Express installed, the queries work fine. I prepare a statement and then bind the columns that will be in the result set. On my system, I get all the data as it should be but on a live system, I do not get the proper data for the last three rows. I don't get any error messages from the query or the column binding and there are also no extra information messages that I can retrieve.

The table is something like the following. The names are changed to protect the guilty.

CREATE TABLE DOWNLOAD

(

FIELD_1 NUMERIC( 6,0 ),

ID CHAR( 15),

FNAME( 30 ),

LNAME( 40 ),

CLIENT_ID NUMERIC( 9,0),

CLIENT_NAME CHAR( 50 ),

CODE NUMERIC( 4,0 ),

PHONE CHAR( 10 )

)

go

On my system, running the exact same binary code as the client machine, I get all of the data from all of the columns as it should be. The problem is when I run on a client's system, the CLIENT_NAME, CODE, and PHONE columns return null values even when there is data there. On my development system the SQL Server instance runs on the same machine. On the client's sytem I am connecting to a remote instance of SQL Server 2000 on another system on the network.

My quandry is what could be different between the two systems that is causing me the problems?

Can you ran SQL Profiler on both machines and see if there is any difference?|||I've turned the logging on at the client side. The logs don't show any errors and it looks like the column binding in SQLBindCol is correct. I haven't seen the server side logs but the gurus on the server side say that they can't see anything wrong there. I've played around with the SQL statement and tried using CONVERT() to change the CHAR to VARCHAR but that doesn't seem to help.

I'm at a total loss why the same code running on my development system runs fine but fails on another system. My guess is that there is some configuration difference but I don't know what that is because I am using the samve version of the SQL Server 2000 ODBC driver on both machines. Its not like there is anything odd or non standard in the table definition either.

|||Just as an update and possibly more information.

I've got it working now but I don't like the solution. What I ended up doing is not binding the columns and calling SQLGetData() after the fetch to get the column data. I don't like this because it costs me about 500 ms for the each time I call the function.

I'd still like to find a solution for why the bound columns don't work.
|||1) I would still recommend you to run SQL Profiler on the servers.
2) How do you bind exactly? Is it possible for you to write (and post the source here) a small ODBC application which demonstrates this problem?|||This is the code I use to bind the columns:

BOOL BindRecord( SQLHSTMT hStmt, PACCDATA_FIELD *pRecord, PINT piRecCount )
{
BOOL bRval = FALSE;
PACCDATA_FIELD pField;
SQLRETURN r;
INT iCnt;
CHAR szBuf[128];
SQLINTEGER len;

if( pRecord && *pRecord )
{
for( iCnt = 0; iCnt < *piRecCount; iCnt++ )
{
pField = *pRecord + iCnt;
len = pField->nLen;

switch( pField->iType )
{
case SQL_CHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pcVal, pField->nDataSize, &len );
break;

case SQL_DATETIME:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_DECIMAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_NUMERIC:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_INTEGER:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_SMALLINT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->sVal, pField->nDataSize, &len );
break;

case SQL_DOUBLE:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_FLOAT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_REAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->fVal, pField->nDataSize, &len );
break;

case SQL_VARCHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pvcVal, pField->nDataSize + 1, &len );
break;

case SQL_UNKNOWN_TYPE:
ST_WriteLog( "st_ctimpact", "BindRecord", "Field data type is SQL_UNKNOWN_TYPE", ST_LOG_DEBUG );
default:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, pField->ptr, pField->nDataSize, &len );
break;
}

if( r == SQL_SUCCESS_WITH_INFO )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLMessages( "BindRecord", SQL_HANDLE_STMT, hStmt );
bRval = TRUE;
}
else if( r != SQL_SUCCESS )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLErrors( "BindRecord", SQL_HANDLE_STMT, hStmt );
}
else
bRval = TRUE;
}
}
return( bRval );
}

A key to remember is that other columns that are bound in this way, and have the same data types, are returning data just fine. I've looked at the logs on the client side where this code works, and there are no errors and the prameters look correct as far as I can tell. Also this code works as advertized on my system but not on the live system. Right now, I don't think my customer will be willing to let me mess around on their system trying to come up with an application that would recreate the problem. Also note that I cannot recreate the problem on my own system. I had hoped that it would be broken on my system so I could debug and find out what was the problem but because it works, I can't.
|||I do not think you have to mess around with your customer system.
I would suggest you write a straightforward ODBC application from scratch just going against this very table.
Use some static arrays and bind directly with SQLBindCol, so to exclude any dependecies on how PACCDATA_FIELD or other parts of your custom code are written.
Then when you are sure it works as supposed on your machine, try it against your customer's.|||Then I guess you didn't read the thread all that well. I don't have to write a test app. The live code works fine on my system on the same table definition in the same database name as the live system. The problem is when I deployed the code, some of the bound columns don't return data. Since I can't recreate the problem on my system, I'm at a loss as to what the problem is.
|||I'm not sure if it is possilbe to resolve your issue without actual experimentation. Your system is not identical to the live system, is it? So your argument that the code works on your system is not helpful to you. If you really want to find out where the problem is you might try and start narrowing down on the issue. That is what I suggested to you.|||It just seemed to me that you asking me to make a test case that is exactly what I have running. I think I might have it working now and it must have something to do with my adding RTRIM() and CONVERT() functions in the select statement. I removed them and it seems to work better now.

Odd issue with bound columns when fetching data.

I'm using ODBC 3.0 in code written in C.

I have an service that connects using a system DSN using the SQL Server 2000 driver. On my development system with SQL Server 2005 Express installed, the queries work fine. I prepare a statement and then bind the columns that will be in the result set. On my system, I get all the data as it should be but on a live system, I do not get the proper data for the last three rows. I don't get any error messages from the query or the column binding and there are also no extra information messages that I can retrieve.

The table is something like the following. The names are changed to protect the guilty.

CREATE TABLE DOWNLOAD

(

FIELD_1 NUMERIC( 6,0 ),

ID CHAR( 15),

FNAME( 30 ),

LNAME( 40 ),

CLIENT_ID NUMERIC( 9,0),

CLIENT_NAME CHAR( 50 ),

CODE NUMERIC( 4,0 ),

PHONE CHAR( 10 )

)

go

On my system, running the exact same binary code as the client machine, I get all of the data from all of the columns as it should be. The problem is when I run on a client's system, the CLIENT_NAME, CODE, and PHONE columns return null values even when there is data there. On my development system the SQL Server instance runs on the same machine. On the client's sytem I am connecting to a remote instance of SQL Server 2000 on another system on the network.

My quandry is what could be different between the two systems that is causing me the problems?

Can you ran SQL Profiler on both machines and see if there is any difference?|||I've turned the logging on at the client side. The logs don't show any errors and it looks like the column binding in SQLBindCol is correct. I haven't seen the server side logs but the gurus on the server side say that they can't see anything wrong there. I've played around with the SQL statement and tried using CONVERT() to change the CHAR to VARCHAR but that doesn't seem to help.

I'm at a total loss why the same code running on my development system runs fine but fails on another system. My guess is that there is some configuration difference but I don't know what that is because I am using the samve version of the SQL Server 2000 ODBC driver on both machines. Its not like there is anything odd or non standard in the table definition either.

|||Just as an update and possibly more information.

I've got it working now but I don't like the solution. What I ended up doing is not binding the columns and calling SQLGetData() after the fetch to get the column data. I don't like this because it costs me about 500 ms for the each time I call the function.

I'd still like to find a solution for why the bound columns don't work.
|||1) I would still recommend you to run SQL Profiler on the servers.
2) How do you bind exactly? Is it possible for you to write (and post the source here) a small ODBC application which demonstrates this problem?|||This is the code I use to bind the columns:

BOOL BindRecord( SQLHSTMT hStmt, PACCDATA_FIELD *pRecord, PINT piRecCount )
{
BOOL bRval = FALSE;
PACCDATA_FIELD pField;
SQLRETURN r;
INT iCnt;
CHAR szBuf[128];
SQLINTEGER len;

if( pRecord && *pRecord )
{
for( iCnt = 0; iCnt < *piRecCount; iCnt++ )
{
pField = *pRecord + iCnt;
len = pField->nLen;

switch( pField->iType )
{
case SQL_CHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pcVal, pField->nDataSize, &len );
break;

case SQL_DATETIME:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_DECIMAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_NUMERIC:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_INTEGER:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_SMALLINT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->sVal, pField->nDataSize, &len );
break;

case SQL_DOUBLE:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_FLOAT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_REAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->fVal, pField->nDataSize, &len );
break;

case SQL_VARCHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pvcVal, pField->nDataSize + 1, &len );
break;

case SQL_UNKNOWN_TYPE:
ST_WriteLog( "st_ctimpact", "BindRecord", "Field data type is SQL_UNKNOWN_TYPE", ST_LOG_DEBUG );
default:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, pField->ptr, pField->nDataSize, &len );
break;
}

if( r == SQL_SUCCESS_WITH_INFO )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLMessages( "BindRecord", SQL_HANDLE_STMT, hStmt );
bRval = TRUE;
}
else if( r != SQL_SUCCESS )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLErrors( "BindRecord", SQL_HANDLE_STMT, hStmt );
}
else
bRval = TRUE;
}
}
return( bRval );
}

A key to remember is that other columns that are bound in this way, and have the same data types, are returning data just fine. I've looked at the logs on the client side where this code works, and there are no errors and the prameters look correct as far as I can tell. Also this code works as advertized on my system but not on the live system. Right now, I don't think my customer will be willing to let me mess around on their system trying to come up with an application that would recreate the problem. Also note that I cannot recreate the problem on my own system. I had hoped that it would be broken on my system so I could debug and find out what was the problem but because it works, I can't.
|||I do not think you have to mess around with your customer system.
I would suggest you write a straightforward ODBC application from scratch just going against this very table.
Use some static arrays and bind directly with SQLBindCol, so to exclude any dependecies on how PACCDATA_FIELD or other parts of your custom code are written.
Then when you are sure it works as supposed on your machine, try it against your customer's.|||Then I guess you didn't read the thread all that well. I don't have to write a test app. The live code works fine on my system on the same table definition in the same database name as the live system. The problem is when I deployed the code, some of the bound columns don't return data. Since I can't recreate the problem on my system, I'm at a loss as to what the problem is.
|||I'm not sure if it is possilbe to resolve your issue without actual experimentation. Your system is not identical to the live system, is it? So your argument that the code works on your system is not helpful to you. If you really want to find out where the problem is you might try and start narrowing down on the issue. That is what I suggested to you.|||It just seemed to me that you asking me to make a test case that is exactly what I have running. I think I might have it working now and it must have something to do with my adding RTRIM() and CONVERT() functions in the select statement. I removed them and it seems to work better now.

Odd issue with bound columns when fetching data.

I'm using ODBC 3.0 in code written in C.

I have an service that connects using a system DSN using the SQL Server 2000 driver. On my development system with SQL Server 2005 Express installed, the queries work fine. I prepare a statement and then bind the columns that will be in the result set. On my system, I get all the data as it should be but on a live system, I do not get the proper data for the last three rows. I don't get any error messages from the query or the column binding and there are also no extra information messages that I can retrieve.

The table is something like the following. The names are changed to protect the guilty.

CREATE TABLE DOWNLOAD

(

FIELD_1 NUMERIC( 6,0 ),

ID CHAR( 15),

FNAME( 30 ),

LNAME( 40 ),

CLIENT_ID NUMERIC( 9,0),

CLIENT_NAME CHAR( 50 ),

CODE NUMERIC( 4,0 ),

PHONE CHAR( 10 )

)

go

On my system, running the exact same binary code as the client machine, I get all of the data from all of the columns as it should be. The problem is when I run on a client's system, the CLIENT_NAME, CODE, and PHONE columns return null values even when there is data there. On my development system the SQL Server instance runs on the same machine. On the client's sytem I am connecting to a remote instance of SQL Server 2000 on another system on the network.

My quandry is what could be different between the two systems that is causing me the problems?

Can you ran SQL Profiler on both machines and see if there is any difference?|||I've turned the logging on at the client side. The logs don't show any errors and it looks like the column binding in SQLBindCol is correct. I haven't seen the server side logs but the gurus on the server side say that they can't see anything wrong there. I've played around with the SQL statement and tried using CONVERT() to change the CHAR to VARCHAR but that doesn't seem to help.

I'm at a total loss why the same code running on my development system runs fine but fails on another system. My guess is that there is some configuration difference but I don't know what that is because I am using the samve version of the SQL Server 2000 ODBC driver on both machines. Its not like there is anything odd or non standard in the table definition either.

|||Just as an update and possibly more information.

I've got it working now but I don't like the solution. What I ended up doing is not binding the columns and calling SQLGetData() after the fetch to get the column data. I don't like this because it costs me about 500 ms for the each time I call the function.

I'd still like to find a solution for why the bound columns don't work.
|||1) I would still recommend you to run SQL Profiler on the servers.
2) How do you bind exactly? Is it possible for you to write (and post the source here) a small ODBC application which demonstrates this problem?|||This is the code I use to bind the columns:

BOOL BindRecord( SQLHSTMT hStmt, PACCDATA_FIELD *pRecord, PINT piRecCount )
{
BOOL bRval = FALSE;
PACCDATA_FIELD pField;
SQLRETURN r;
INT iCnt;
CHAR szBuf[128];
SQLINTEGER len;

if( pRecord && *pRecord )
{
for( iCnt = 0; iCnt < *piRecCount; iCnt++ )
{
pField = *pRecord + iCnt;
len = pField->nLen;

switch( pField->iType )
{
case SQL_CHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pcVal, pField->nDataSize, &len );
break;

case SQL_DATETIME:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_DECIMAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->ucVal, pField->nDataSize, &len );
break;

case SQL_NUMERIC:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_INTEGER:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->lVal, pField->nDataSize, &len );
break;

case SQL_SMALLINT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->sVal, pField->nDataSize, &len );
break;

case SQL_DOUBLE:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_FLOAT:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->dVal, pField->nDataSize, &len );
break;

case SQL_REAL:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, &pField->fVal, pField->nDataSize, &len );
break;

case SQL_VARCHAR:
r = SQLBindCol( hStmt, pField->iColNum, SQL_C_CHAR, pField->pvcVal, pField->nDataSize + 1, &len );
break;

case SQL_UNKNOWN_TYPE:
ST_WriteLog( "st_ctimpact", "BindRecord", "Field data type is SQL_UNKNOWN_TYPE", ST_LOG_DEBUG );
default:
r = SQLBindCol( hStmt, pField->iColNum, pField->iType, pField->ptr, pField->nDataSize, &len );
break;
}

if( r == SQL_SUCCESS_WITH_INFO )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLMessages( "BindRecord", SQL_HANDLE_STMT, hStmt );
bRval = TRUE;
}
else if( r != SQL_SUCCESS )
{
lstrcpy( szBuf, "Field name: " );
lstrcat( szBuf, pField->szColName );
ST_WriteLog( "st_AcceleratedData", "BindRecord", szBuf, ST_LOG_WARNING );
ShowSQLErrors( "BindRecord", SQL_HANDLE_STMT, hStmt );
}
else
bRval = TRUE;
}
}
return( bRval );
}

A key to remember is that other columns that are bound in this way, and have the same data types, are returning data just fine. I've looked at the logs on the client side where this code works, and there are no errors and the prameters look correct as far as I can tell. Also this code works as advertized on my system but not on the live system. Right now, I don't think my customer will be willing to let me mess around on their system trying to come up with an application that would recreate the problem. Also note that I cannot recreate the problem on my own system. I had hoped that it would be broken on my system so I could debug and find out what was the problem but because it works, I can't.
|||I do not think you have to mess around with your customer system.
I would suggest you write a straightforward ODBC application from scratch just going against this very table.
Use some static arrays and bind directly with SQLBindCol, so to exclude any dependecies on how PACCDATA_FIELD or other parts of your custom code are written.
Then when you are sure it works as supposed on your machine, try it against your customer's.|||Then I guess you didn't read the thread all that well. I don't have to write a test app. The live code works fine on my system on the same table definition in the same database name as the live system. The problem is when I deployed the code, some of the bound columns don't return data. Since I can't recreate the problem on my system, I'm at a loss as to what the problem is.
|||I'm not sure if it is possilbe to resolve your issue without actual experimentation. Your system is not identical to the live system, is it? So your argument that the code works on your system is not helpful to you. If you really want to find out where the problem is you might try and start narrowing down on the issue. That is what I suggested to you.|||It just seemed to me that you asking me to make a test case that is exactly what I have running. I think I might have it working now and it must have something to do with my adding RTRIM() and CONVERT() functions in the select statement. I removed them and it seems to work better now.

Monday, March 12, 2012

ODBC, Excel, SQL Server

I have a user accessing SQL Server 2000 data through Excel
and MSQuery...we have used ODBC DSN with no probs. It is
only this user with an issue, so very specific to their
setup somehow.
Example databases called A and B.
User had ODBC DSN set up to default database A.
We want it to be B.
Edited DSN to have default database of B.
No prob. Saved, verified, successful. Just like in past.
HOWEVER, when creating a NEW Excel spreadsheet and NEW DB
Query using this DSN, it STILL points to database A for
some reason. There are no other DSNs with this name
(system, file, or user).
Any idea why it is pointing to the old db, and WHERE it is
getting this from? I have tried removing the DSN and
recreating it. I have tried using other people's logins
instead of his. This works fine on any other computer we
try it on.
Perplexed,
Sharon
I think this might be caused by using an Excel data source that points to
the old ODBC DSN. Excel builds its own wrapper for ODBC data sources and
typically stores them as .odc files. These are separate entries from the
ODBC data source that you build using the ODBC Administrator. Try opening
Excel, using the Data | Import External Data | Import Data option to display
the Select Data Source dialog. Then delete the old data source by right
clicking on it and selecting Delete from the pop-up menu. Once the old Excel
data source file is deleted build a new one by clicking the New Source
button and following the wizard dialogs.
Mike O.
"Sharon" <beall2@.llnl.gov> wrote in message
news:12e3201c411fc$714a9300$a301280a@.phx.gbl...
> I have a user accessing SQL Server 2000 data through Excel
> and MSQuery...we have used ODBC DSN with no probs. It is
> only this user with an issue, so very specific to their
> setup somehow.
> Example databases called A and B.
> User had ODBC DSN set up to default database A.
> We want it to be B.
> Edited DSN to have default database of B.
> No prob. Saved, verified, successful. Just like in past.
> HOWEVER, when creating a NEW Excel spreadsheet and NEW DB
> Query using this DSN, it STILL points to database A for
> some reason. There are no other DSNs with this name
> (system, file, or user).
> Any idea why it is pointing to the old db, and WHERE it is
> getting this from? I have tried removing the DSN and
> recreating it. I have tried using other people's logins
> instead of his. This works fine on any other computer we
> try it on.
> Perplexed,
> Sharon
>

ODBC, Excel, SQL Server

I have a user accessing SQL Server 2000 data through Excel
and MSQuery...we have used ODBC DSN with no probs. It is
only this user with an issue, so very specific to their
setup somehow.
Example databases called A and B.
User had ODBC DSN set up to default database A.
We want it to be B.
Edited DSN to have default database of B.
No prob. Saved, verified, successful. Just like in past.
HOWEVER, when creating a NEW Excel spreadsheet and NEW DB
Query using this DSN, it STILL points to database A for
some reason. There are no other DSNs with this name
(system, file, or user).
Any idea why it is pointing to the old db, and WHERE it is
getting this from? I have tried removing the DSN and
recreating it. I have tried using other people's logins
instead of his. This works fine on any other computer we
try it on.
Perplexed,
SharonI think this might be caused by using an Excel data source that points to
the old ODBC DSN. Excel builds its own wrapper for ODBC data sources and
typically stores them as .odc files. These are separate entries from the
ODBC data source that you build using the ODBC Administrator. Try opening
Excel, using the Data | Import External Data | Import Data option to display
the Select Data Source dialog. Then delete the old data source by right
clicking on it and selecting Delete from the pop-up menu. Once the old Excel
data source file is deleted build a new one by clicking the New Source
button and following the wizard dialogs.
Mike O.
"Sharon" <beall2@.llnl.gov> wrote in message
news:12e3201c411fc$714a9300$a301280a@.phx
.gbl...
> I have a user accessing SQL Server 2000 data through Excel
> and MSQuery...we have used ODBC DSN with no probs. It is
> only this user with an issue, so very specific to their
> setup somehow.
> Example databases called A and B.
> User had ODBC DSN set up to default database A.
> We want it to be B.
> Edited DSN to have default database of B.
> No prob. Saved, verified, successful. Just like in past.
> HOWEVER, when creating a NEW Excel spreadsheet and NEW DB
> Query using this DSN, it STILL points to database A for
> some reason. There are no other DSNs with this name
> (system, file, or user).
> Any idea why it is pointing to the old db, and WHERE it is
> getting this from? I have tried removing the DSN and
> recreating it. I have tried using other people's logins
> instead of his. This works fine on any other computer we
> try it on.
> Perplexed,
> Sharon
>

Friday, March 9, 2012

ODBC to SQL Server through DSN fails once in a while

Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.odbc:43808
Hello:
I have multiple ODBC connections to our SQL Server, and they are mostly
working well.
I have an issue once in a while with the connection when the DSN is not the
DSN used to create the linked table. For example, If the DSN is named the
same, but is connecting through IP address vs. Computer Name, the connection
will fail.
I just thought I'd post this to see if there are other similar situations,
maybe some ways around it?
Thanks,
Kyle
"Kyle McAdam" <kyle.mcadam@.sympatico.ca> wrote in message
news:Tw%dd.56921$JG5.927915@.news20.bellglobal.com. ..
> Hello:
> I have multiple ODBC connections to our SQL Server, and they are mostly
> working well.
> I have an issue once in a while with the connection when the DSN is not
the
> DSN used to create the linked table. For example, If the DSN is named the
> same, but is connecting through IP address vs. Computer Name, the
connection
> will fail.
> I just thought I'd post this to see if there are other similar situations,
> maybe some ways around it?
> Thanks,
> Kyle
In the DSN configuration, click Client Configuration and make sure TCP/IP is
checked as a protocol. You can also Alias a server name in this screen. I've
found that to work well.

ODBC to SQL Server through DSN fails once in a while

Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.odbc:43808
Hello:
I have multiple ODBC connections to our SQL Server, and they are mostly
working well.
I have an issue once in a while with the connection when the DSN is not the
DSN used to create the linked table. For example, If the DSN is named the
same, but is connecting through IP address vs. Computer Name, the connection
will fail.
I just thought I'd post this to see if there are other similar situations,
maybe some ways around it?
Thanks,
Kyle"Kyle McAdam" <kyle.mcadam@.sympatico.ca> wrote in message
news:Tw%dd.56921$JG5.927915@.news20.bellglobal.com...
> Hello:
> I have multiple ODBC connections to our SQL Server, and they are mostly
> working well.
> I have an issue once in a while with the connection when the DSN is not
the
> DSN used to create the linked table. For example, If the DSN is named the
> same, but is connecting through IP address vs. Computer Name, the
connection
> will fail.
> I just thought I'd post this to see if there are other similar situations,
> maybe some ways around it?
> Thanks,
> Kyle
In the DSN configuration, click Client Configuration and make sure TCP/IP is
checked as a protocol. You can also Alias a server name in this screen. I've
found that to work well.

ODBC Timeout Error

Hi All,

I have one problem in connecting to SQL Server DSN thru Microsoft ODBC. The program was working properly and suddenly from few days, getting "-21472117871 [Microsoft][ODBC SQL Server Driver] Timeout Expired". And no new MS patches or SP installed recently.

I am using this in vbscript with the database connection with execute statement. Sometimes it takes 20-40 secs to get the resultset or sometimes timesout. What could be reason ? Is the database size, memory, transaction log size ?

For Example : Set adoAcctsRst = comDatabaseConnection.Execute("Services.dbo.AISSP_GetAccts '" & strUser & "' " )

Services is the Database, and AISSP_ is the stored procedure to execute with the input parameter as UserName. comDataBaseconnection is the command to connect to DSN.

Its getting timedout in this statement. What could be the solution ? Is it at the SQL Database or network connection ?

Appreciate for ur immedaite reply as this is urgent !!
Thanks in advanceWell it could be that the load on the DB is too much, it could be that the table needs a decent index on for the search criteria it could be load on the network.

You could also include your timeout on your connection when you connect to the database...

I would try the others first though,.. starting with the index...|||Do you have a baseline of what this stored procedure should take to run ? Have you run the stored procedure in query analyzer (how long does it take) ? If it taks a long time, copy the stored procedure content in qa and see if the duration is the same. If you had a recent jump/decline in the number of records that this stored procedure normally handles, this could also cause these problems.

Wednesday, March 7, 2012

ODBC System DSN Questions

We are running an SBS2000 network with around 40 clients being 60% Windows
2000 Pro and 40% WinXP Pro. We have around 3 member servers (not DC) and one
of the servers is a SQL server running SQL 2000.
A user on the domain has created a dBasev5.7 form that needs an ODBC System
DSN connection from the client to the SQL server in order for his form to be
populated with data. He wanted to roll out the DSNs to all the machines on
the network via Group Policy - I did a bit of digging around in the
Newsgroups and someone suggested this automated way by running a vbs script:
http://www.databasejournal.com/featu...e.php/2238221. Although
this works - we have a slight problem. We have no idea if this is to do with
dBase (it uses 16-bit architecture) but when we roll out the DSNs using the
script the registry gets updated (HKEYLOCAL
MACHINE>SOFTWARE>ODBC>ODBC.INI...) with all the right keys (as if you set it
up manually in Control Panel's ODBC) but we need to go through the System DSN
wizard (to the last page of the wizard) and click the "Test connection"
button in order for the dBase program to access the ODBC database connection.
It seems as if the ODBC System DSN is dead without clicking the "Test
Connection" button.
Questions:
1. Is it a requirement to hit the Test Network Connection button on the
last page of the wizard. I thought that this was only for troubleshooting?
2. It appears that this "Test Connection" button in the wizard posts a
registry key to allow the ODBC SYstem DSN (it has created) to be used. Where
abouts is this registry key?
3. Is there a Group Policy way of doing this? Chances are we may change
settings in the future and may want a server-side script running to update
any changes to clients automatically.
Please help.
THanks,
Skc
I am not usre why this is happening, but I can tell you that the Test
Connection button does not write a registry entry anywhere. It is just used
for testing the connection. Possibly teh script leaves something out that
is necessary and going through the wizard completes the process.
It is possible that an alias to the SQL Server is geing created when the
wizard is accessed. There is a cliconfg tuiltiy that you can use to verify
this.
Run the script on a client machine and then run cliconfg from Start - Run.
Check the alias tab to see if there is an alias to this SQL Server. If not,
then run the Wizard and go through the steps. After it completes go back to
cliconfg and see if there is an alias. In many case the cliconfg utility
will create an alias or a SQL Server when a DSN has been created.
Rand
This posting is provided "as is" with no warranties and confers no rights.

ODBC System DSN Questions

We are running an SBS2000 network with around 40 clients being 60% Windows
2000 Pro and 40% WinXP Pro. We have around 3 member servers (not DC) and on
e
of the servers is a SQL server running SQL 2000.
A user on the domain has created a dBasev5.7 form that needs an ODBC System
DSN connection from the client to the SQL server in order for his form to be
populated with data. He wanted to roll out the DSNs to all the machines on
the network via Group Policy - I did a bit of digging around in the
Newsgroups and someone suggested this automated way by running a vbs script:
http://www.databasejournal.com/feat...le.php/2238221. Although
this works - we have a slight problem. We have no idea if this is to do wit
h
dBase (it uses 16-bit architecture) but when we roll out the DSNs using the
script the registry gets updated (HKEYLOCAL
MACHINE>SOFTWARE>ODBC>ODBC.INI...) with all the right keys (as if you set it
up manually in Control Panel's ODBC) but we need to go through the System DS
N
wizard (to the last page of the wizard) and click the "Test connection"
button in order for the dBase program to access the ODBC database connection
.
It seems as if the ODBC System DSN is dead without clicking the "Test
Connection" button.
Questions:
1. Is it a requirement to hit the Test Network Connection button on the
last page of the wizard. I thought that this was only for troubleshooting?
2. It appears that this "Test Connection" button in the wizard posts a
registry key to allow the ODBC SYstem DSN (it has created) to be used. Wher
e
abouts is this registry key?
3. Is there a Group Policy way of doing this? Chances are we may change
settings in the future and may want a server-side script running to update
any changes to clients automatically.
Please help.
THanks,
SkcI am not usre why this is happening, but I can tell you that the Test
Connection button does not write a registry entry anywhere. It is just used
for testing the connection. Possibly teh script leaves something out that
is necessary and going through the wizard completes the process.
It is possible that an alias to the SQL Server is geing created when the
wizard is accessed. There is a cliconfg tuiltiy that you can use to verify
this.
Run the script on a client machine and then run cliconfg from Start - Run.
Check the alias tab to see if there is an alias to this SQL Server. If not,
then run the Wizard and go through the steps. After it completes go back to
cliconfg and see if there is an alias. In many case the cliconfg utility
will create an alias or a SQL Server when a DSN has been created.
Rand
This posting is provided "as is" with no warranties and confers no rights.

ODBC system dsn problem

We have a client that is trying to connect to a SQL DB on
a Win2003 server (thru Citrix) using a system dsn. When a
user tries connecting using the system dsn in Crystal
Reports (or anyting else for that matter), they get the
following error: data source name not found and no default
driver specified.
If you go into the ODBC manager, the data source is there
but when you try to configure it you get - dsnname is not
an existing data source name. when you click on ok you
then get - invalid dsn.
If you log onto the workstation as a user with
administrator rights, none of these errors occur.
I have looked at our Citrix machine and 2 other customer
Citrix machines that are running the same software and I
realy don't see any differences. Our's and the other 2
customers work without the user having admin privleges.
Everything points to a permissions problem but whatever it
is, is alluding me. any help at this point is appreciated.
TIA,
BillODBC entries are controlled in the registry. I would suggest using
regedt32 or regedit (if you are on Win 20003/XP), and go to
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and try adding full control permissions
for the affected user/groups, replacing the values in the subkeys. Good
luck.
****************************************
Andy S.
MCSE NT/2000, MCDBA SQL 7/2000
andymcdba1@.NOMORESPAM.yahoo.com
Please remove NOMORESPAM before replying.
This posting is provided "as is" with
no warranties and confers no rights.
****************************************
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Thanks Andy. I received a similar response on a SQL Mail
list that I posted to. The registry seems to have been the
problem. I changed the permissions giving access to the
everyone group. I then tested going into the odbc
configuration as one of the users that was having problems
and I no longer get an error. I have the customer testing
an Access program that has linked tables using the system
dsn.
Bill

>--Original Message--
>ODBC entries are controlled in the registry. I would
suggest using
>regedt32 or regedit (if you are on Win 20003/XP), and go
to
>HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and try adding full
control permissions
>for the affected user/groups, replacing the values in the
subkeys. Good
>luck.
> ****************************************
>Andy S.
>MCSE NT/2000, MCDBA SQL 7/2000
>andymcdba1@.NOMORESPAM.yahoo.com
>Please remove NOMORESPAM before replying.
>This posting is provided "as is" with
>no warranties and confers no rights.
> ****************************************
>*** Sent via Developersdex http://www.examnotes.net
***
>Don't just participate in USENET...get rewarded for it!
>.
>

ODBC system DSN Issue

Hi,
I have a problem with SQL 2005, ODBC Connection,
I did create a ODBC conection with user DSN to a SQL 2005 database, and
there is a 3rd party aplication that we use to access that SQL database ever
y
thing went fine.
I did create ODBC connection with System DSN to the same Database but when
I try to open the database with our 3rd party application I get this error:
The datasource you specified does not exist.
Any idea why I can access the same database on the same SQL server with user
DSN and not with System DSN?
We are useing Windows 2003R2 (64 bit) and SQL 2005 (64 bit).
Thanks,
Shahin.ODBC on an x64 based OS has 2 sets of system DSN settings stored in the
registry.
If you run: %SystemRoot%\SysWOW64\odbcad32.exe you modify the 32bit
settings.
If you run: %SystemRoot%\system32\odbcad32.exe you modify the 64bit
settings.
32bit client applications use the 32bit settings, 64bit apps use the 64bit
settings.
So, first check which system DSN settings you set (32 or 64bit), then check
the 3rd party app to see if it's 32 or 64bit.
cmk|||Hi Chris,
Thanks for info it was very helpful and it did solve my problem
"Chris Kushnir" wrote:

> ODBC on an x64 based OS has 2 sets of system DSN settings stored in the
> registry.
> If you run: %SystemRoot%\SysWOW64\odbcad32.exe you modify the 32bit
> settings.
> If you run: %SystemRoot%\system32\odbcad32.exe you modify the 64bit
> settings.
> 32bit client applications use the 32bit settings, 64bit apps use the 64bit
> settings.
> So, first check which system DSN settings you set (32 or 64bit), then chec
k
> the 3rd party app to see if it's 32 or 64bit.
>
> cmk
>
>

Saturday, February 25, 2012

ODBC Provider for DSN through connection object?

Is it possible to find out Name or description of the ODBC driver using connection object?
I am not setting up the provider in the code. Only thing I set as connection string is the name of DSN. This DSN could point to any database, I need to figure out which databse it is (As in SqlServer or Oracle)! Hopefully I can do this using a connection object.

Can someone please direct me to the property that is can use for this? An exaple would be helpful, any help is appreciated.

--Shilpa

I know through non-managed code you can access this information through SQLGetInfo calls. For example:

SQLGetInfo(..., SQL_DBMS_NAME, ...) --> returns name of driver used in connection string

SQLGetInfo(..., SQL_DRIVER_NAME, ...) --> returns name of driver's DLL

SQLGetInfo(..., SQL_DRIVER_VER, ...) --> returns version of driver

There are many other keywords you can use to determine at runtime many attributes about the driver and the server. There's a more complete listing on http://msdn2.microsoft.com/en-us/library/ms131672.aspx

As an alternatve, and if you have access, you could browse your registry since this is where your DSN information is stored. (HKEY_LOCAL_MACHINE\SOFTWARE\ODBC for system DSN's, HKEY_CURRENT_USER\Software\ODBC for user DSN's).

~Warren

ODBC problems

I have next to no experience with databases, so please bear with me. We have an application that requires setting up a system DSN with a SQL Server driver. I am able to do so on one computer. When I go to another I start the process to add the DSN, I type in the server name and then I have to select the default database on that server. In the dropdown list of databases, only 5 or 6 appear... none of which is the one that I need. I am going through the same steps on each computer and do not know why it would not be recognizing it. Does anyone have any ideas?By the way, I have SQL Server 2000 on Windows Server 2003. All machines are Windows XP with Windows firewall disabled.|||More than likely it is a permissions issue. You would have to grant access to the target database for the login that you are using.

In Enterprise Manager, expand the server node, expand the security node, click on the logins node. In the right-hand pane, select the login you are using and double click. On the database access tab, check the databases to which the login will have access. Also check the db_owner item in the right-hand pane**.

** Note that this is a BAD practice. However, you are indicating that you have no db experience and this will ensure that you get your users up and running quickly with minimal issues which good security can sometimes cause. You are essentially exposing your data to the user community and they may be able to update, delete data or even whole tables with the db_owner permission. Read up on user security and tighten the security back down when you understand better what your user requirements are.

Regards,

hmscott

ODBC problem

I have been trying to reconfigure specific System DSN's in the ODBC System A
dministrator thru the Control Panel. When I click on Add or Configure button
s, nothing happes. I have tried this at the Domain and Local level with the
same results. I have tried
it as a user and administrator with nothing. This is a W2k PC with SP4 (just
updated) which had MDAC 2.7. I tried to update to MDAC 2.8 which did not so
lve the problem. I reinstalled the MDAC 2.7 and the result was the same. Wha
t could be stopping the Ad
ding or Configuring process from the ODBC Control Panel?
Thanks for any help in this matter.Hello,
double click on your existing dsn and see if configure window is appear
or not.
tell me .
Thanks,
Warm Regards,
Ayaz Ahmed
Software Engineer & Web Developer
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"
http://www.csquareonline.com
Karachi, Pakistan
Mobile +92 300 2280950
Office +92 21 455 2414
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

ODBC problem

I am trying to set up a connection on a Windows 2003
Terminal Server. I am using the Microsoft ODBC for
Oracle driver to create a System DSN. Under the
administrator account I create it and the application
works. When I log into Terminal Services as a user or
even a power user the connection will not work. How can
I create a System DSN that all users will be able to use
without granting administrator privileges?
Thanks
.Try granting Everyone read access to the following registry on the TS
machine:
HKLM\Software\ODBC\ODBC.INI.
This is the key where all system DSNs are stored.
Rand
This posting is provided "as is" with no warranties and confers no rights.

ODBC Port

Hi, I have just installed a default instance of SQL server 2000 and can
connect ok with Query Analyser. I can connect ok with ODBC via a DSN if I
don't specify the port. However if I specify the port (which is 1433 I've
double checked) in the DSN or a JDBC connection it fails! Can somebody help
me?
Thanks
Adam Sankey
on the sql serve box :
check the programs->sqlserver2000>sql server network utilitity
click tcp and check properties
you should be able to see the port configured, if tcp is enabled
thanks
"Adam Sankey" <AdamSankey@.discussions.microsoft.com> wrote in message
news:5F774885-4F36-436F-9AF9-6AA5A4586426@.microsoft.com...
> Hi, I have just installed a default instance of SQL server 2000 and can
> connect ok with Query Analyser. I can connect ok with ODBC via a DSN if I
> don't specify the port. However if I specify the port (which is 1433 I've
> double checked) in the DSN or a JDBC connection it fails! Can somebody
> help
> me?
> Thanks
> Adam Sankey

ODBC Port

Hi, I have just installed a default instance of SQL server 2000 and can
connect ok with Query Analyser. I can connect ok with ODBC via a DSN if I
don't specify the port. However if I specify the port (which is 1433 I've
double checked) in the DSN or a JDBC connection it fails! Can somebody help
me?
Thanks
Adam Sankeyon the sql serve box :
check the programs->sqlserver2000>sql server network utilitity
click tcp and check properties
you should be able to see the port configured, if tcp is enabled
thanks
"Adam Sankey" <AdamSankey@.discussions.microsoft.com> wrote in message
news:5F774885-4F36-436F-9AF9-6AA5A4586426@.microsoft.com...
> Hi, I have just installed a default instance of SQL server 2000 and can
> connect ok with Query Analyser. I can connect ok with ODBC via a DSN if I
> don't specify the port. However if I specify the port (which is 1433 I've
> double checked) in the DSN or a JDBC connection it fails! Can somebody
> help
> me?
> Thanks
> Adam Sankey

Monday, February 20, 2012

ODBC Linked Server & DSN

Hi,
Short version of question:
For linked servers to ODBC DSN data sources, does the DSN have to be setup
on the same windows server as the sql server 2005 instance? Or is only
requirment that the DSN is setup from the workstaing that is luanching SSMS?
Longer Background for question:
I'm attempting to setup a linked server in SQL Server 2005 to an ODBC
datasource which is Centura SQLbase database.
On my workstation, I have a DSN setup with the odbc drivers to connect to
the SQLbase db. The driver was "Centura SQLBase 3.60 32-bit Driver -NT &
Win95"
I can successfully import that tables from SQLBase using Access.
I'm using the SQL Server Managment Studio from my desktop to connect to the
SQL 2005 Server on a Windows 2003 Server.
When testing the Linked server by using a query, I use the following syntax
in a query in SSMS:
SELECT LastName, FirstName FROM LINK2SQLBASE.COMPANYDB.dbo.tblEmployee
I receive an Error:
*OLE DB provider "MSDASQL" for linked server... returned message
"[Microsoft][ODBC Driver Manager] Data source name not found and no
default
driver specified".
*Msg 7303, Level 16, State 1, Line 1
*Cannot initialize the data source object of OLE DB provider "MSDASQL" for
linked server...
Again, i'm using the SSMS from my workstation that has the DSN setup and
works fine when importing from access. I do NOT have the DSN or drivers on
the actual windwows 2003 Server where the SQL Sever 2005 instance is on.
Is that my promblem? Do I need the DSN on the actual windows 2003 server, or
should I be albe to use the DSN from my workstation?
Thanks in advanced!On Fri, 12 Jan 2007 14:11:04 -0800,
labsRcoolcommunitynospan@.discussions.microsoft.com wrote:
You will need to setup the driver and DSN on the SQL Server machine.
When you issue a query to a linked server, the client machine only knows
that it is talking to a SQL Server. The SQL Server then makes the request
to the remote data source. So the SQL Server has to have all the required
drivers, DSNs and privileges required to access the remote data source.
Darren Gosbell
SQL Server MVP

> Hi,
> Short version of question:
> For linked servers to ODBC DSN data sources, does the DSN have to be
setup
> on the same windows server as the sql server 2005 instance? Or is only
> requirment that the DSN is setup from the workstaing that is luanching
SSMS?
>
> Longer Background for question:
> I'm attempting to setup a linked server in SQL Server 2005 to an ODBC
> datasource which is Centura SQLbase database.
> On my workstation, I have a DSN setup with the odbc drivers to connect to
> the SQLbase db. The driver was "Centura SQLBase 3.60 32-bit Driver -NT &
> Win95"
> I can successfully import that tables from SQLBase using Access.
> I'm using the SQL Server Managment Studio from my desktop to connect to
the
> SQL 2005 Server on a Windows 2003 Server.
> When testing the Linked server by using a query, I use the following
syntax
> in a query in SSMS:
> SELECT LastName, FirstName FROM LINK2SQLBASE.COMPANYDB.dbo.tblEmployee
> I receive an Error:
> *OLE DB provider "MSDASQL" for linked server... returned message
> "[Microsoft][ODBC Driver Manager] Data source name not found and no[/vbcol
]
default[vbcol=seagreen]
> driver specified".
> *Msg 7303, Level 16, State 1, Line 1
> *Cannot initialize the data source object of OLE DB provider "MSDASQL"
for
> linked server...
> Again, i'm using the SSMS from my workstation that has the DSN setup and
> works fine when importing from access. I do NOT have the DSN or drivers
on
> the actual windwows 2003 Server where the SQL Sever 2005 instance is on.
> Is that my promblem? Do I need the DSN on the actual windows 2003 server,
or
> should I be albe to use the DSN from my workstation?
> Thanks in advanced!

ODBC Invalid DNS Error

I try and remove an entry from ODBC administrator, USER
DSN tab, and i get the error, INVALID DSN.
how can i remove this entry?I had this same problem and after a little searching found a fix at e.ms/archive86-2004-3-446049.html" target="_blank">http://www.mcs
e.ms/archive86-2004-3-446049.html
Here it is:
ODBC entries are controlled in the registry. I would suggest using
regedt32 or regedit (if you are on Win 20003/XP), and go to
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and try adding full control permissions
for the affected user/groups, replacing the values in the subkeys. Good
luck.
Andy S.
2004-03-04, 12:24 pm
It took a little bit of fighting in my case to get it to take, but when it d
id I logged out then back in and it worked like a charm.
-Nick