Monday, March 19, 2012
ODBC API Question
Quick question about the ODBC API. Is there a function in the ODBC API that
I can call to determine what parameters a particular driver requires? For
instance, ODBC Administrator knows to allow you to select, create, repair or
compact an MS Access Database; but for SQL Server it offers different
options, including default database, use ANSI quoted identifiers, etc. Does
ODBC Administrator determine this via a function in the ODBC API, or is this
hard-coded into the ODBC Administrator?
Thanks,
Michael C.
There are various API calls that you can make to figure this out,
ODBCAD32.EXE does this dynamically. Best is to use ODBC Test
http://msdn.microsoft.com/library/de...t_overview.asp
that comes with the MDAC SDK or the Platform SDK, it allows you to use all
these APIs interactively from a UI, so you can play around with them,
otherwise they are all documented in the programmer reference guide.
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2004 All rights reserved.
"Michael C" <michaelc@.nospam.org> wrote in message
news:QAXNc.16090$09.2465831@.news4.srv.hcvlny.cv.ne t...
> Hi all,
> Quick question about the ODBC API. Is there a function in the ODBC API
> that
> I can call to determine what parameters a particular driver requires? For
> instance, ODBC Administrator knows to allow you to select, create, repair
> or
> compact an MS Access Database; but for SQL Server it offers different
> options, including default database, use ANSI quoted identifiers, etc.
> Does
> ODBC Administrator determine this via a function in the ODBC API, or is
> this
> hard-coded into the ODBC Administrator?
> Thanks,
> Michael C.
>
ODBC API Question
Quick question about the ODBC API. Is there a function in the ODBC API that
I can call to determine what parameters a particular driver requires? For
instance, ODBC Administrator knows to allow you to select, create, repair or
compact an MS Access Database; but for SQL Server it offers different
options, including default database, use ANSI quoted identifiers, etc. Does
ODBC Administrator determine this via a function in the ODBC API, or is this
hard-coded into the ODBC Administrator?
Thanks,
Michael C.There are various API calls that you can make to figure this out,
ODBCAD32.EXE does this dynamically. Best is to use ODBC Test
t_overview.asp" target="_blank">http://msdn.microsoft.com/library/d...
t_overview.asp
that comes with the MDAC SDK or the Platform SDK, it allows you to use all
these APIs interactively from a UI, so you can play around with them,
otherwise they are all documented in the programmer reference guide.
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2004 All rights reserved.
"Michael C" <michaelc@.nospam.org> wrote in message
news:QAXNc.16090$09.2465831@.news4.srv.hcvlny.cv.net...
> Hi all,
> Quick question about the ODBC API. Is there a function in the ODBC API
> that
> I can call to determine what parameters a particular driver requires? For
> instance, ODBC Administrator knows to allow you to select, create, repair
> or
> compact an MS Access Database; but for SQL Server it offers different
> options, including default database, use ANSI quoted identifiers, etc.
> Does
> ODBC Administrator determine this via a function in the ODBC API, or is
> this
> hard-coded into the ODBC Administrator?
> Thanks,
> Michael C.
>
Monday, March 12, 2012
ODBC and MSDE
I'm not sure if it is right group for this question, but I hope that
I'll get help here...
I'm using MSDE to store data for my application. And I'm having such
problem. I'm creating a table in DB for string connection information:
CREATE TABLE sql (
action_id int NOT NULL default '0',
database_name varchar(20) NOT NULL default '',
username varchar(15) NOT NULL default '',
password varchar(15) NOT NULL default '',
PRIMARY KEY (action_id)
);
Field 'database_name' stands for the DB name used by ODBC (In my Java
application I'm using ODBC, to connect to particular DB). So when I'm
adding a record to this table, for instance:
1, "MySQL", "root", "password"
ODBC || MSDE || JDBC changes the values by adding free space to fill
all the field's spaces (Instead of "MySQL" it adds "MySQL
"). It seems like some component doesn't understand that I'm using
varchar(20), not char.
For instance, when I'm using MySQL DB server, such problem doesn't
introduce itself... Does anyone know how to manage this?
Thank you,
AudriusWhen I tried to insert data into MSDE table using console, everything
worked fine. The data occupies exactly as it should ("MySQL" - 5
symbols). But when I do this using ODBC from my application, it doesn't
work right. Can anyone suggest me a solution?|||Audrius (audrius.peseckis@.gmail.com) writes:
> I'm not sure if it is right group for this question, but I hope that
> I'll get help here...
> I'm using MSDE to store data for my application. And I'm having such
> problem. I'm creating a table in DB for string connection information:
> CREATE TABLE sql (
> action_id int NOT NULL default '0',
> database_name varchar(20) NOT NULL default '',
> username varchar(15) NOT NULL default '',
> password varchar(15) NOT NULL default '',
> PRIMARY KEY (action_id)
> );
> Field 'database_name' stands for the DB name used by ODBC (In my Java
> application I'm using ODBC, to connect to particular DB). So when I'm
> adding a record to this table, for instance:
> 1, "MySQL", "root", "password"
> ODBC || MSDE || JDBC changes the values by adding free space to fill
> all the field's spaces (Instead of "MySQL" it adds "MySQL
> "). It seems like some component doesn't understand that I'm using
> varchar(20), not char.
It appears that your app passes "MySQL ". In such case,
SQL Server will store the trailing spaces when the ANSI_PADDING
option is in effect, which it is by default when you use ODBC. You
need to trim the trailing spaces somewhere on the line.
There are a few more possibilities, but I can't really speculate
about them, as you did not provide any code.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Yes, it solved the problem. ODBC was set to use ANSI padding by
default. Your reply saved me a lot of time, thank you.
Audrius|||Audrius (audrius.peseckis@.gmail.com) writes:
> Yes, it solved the problem. ODBC was set to use ANSI padding by
> default. Your reply saved me a lot of time, thank you.
While turning of ANSI_PADDING may solve the problem, be aware of
that there are features in SQL Server that require ANSI_PADDING to
be on. In SQL 2000 that is indexed views and indexes on computed
columns. I believe there are more features in SQL 2005.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
ODBC and MSDE
I'm not sure if it is right group for this question, but I hope that
I'll get help here...
I'm using MSDE to store data for my application. And I'm having such
problem. I'm creating a table in DB for string connection information:
CREATE TABLE sql (
action_id int NOT NULL default '0',
database_name varchar(20) NOT NULL default '',
username varchar(15) NOT NULL default '',
password varchar(15) NOT NULL default '',
PRIMARY KEY (action_id)
);
Field 'database_name' stands for the DB name used by ODBC (In my Java
application I'm using ODBC, to connect to particular DB). So when I'm
adding a record to this table, for instance:
1, "MySQL", "root", "password"
ODBC || MSDE || JDBC changes the values by adding free space to fill all
the field's spaces (Instead of "MySQL" it adds "MySQL "). It
seems like some component doesn't understand that I'm using varchar(20),
not char.
For instance, when I'm using mysql DB server, such problem doesn't
introduce itself... Does anyone know how to manage this?
Thank you,
AudriusAudrius wrote:
> Hello,
> I'm not sure if it is right group for this question, but I hope that
> I'll get help here...
> I'm using MSDE to store data for my application. And I'm having such
> problem. I'm creating a table in DB for string connection information:
> CREATE TABLE sql (
> action_id int NOT NULL default '0',
> database_name varchar(20) NOT NULL default '',
> username varchar(15) NOT NULL default '',
> password varchar(15) NOT NULL default '',
> PRIMARY KEY (action_id)
> );
> Field 'database_name' stands for the DB name used by ODBC (In my Java
> application I'm using ODBC, to connect to particular DB). So when I'm
> adding a record to this table, for instance:
> 1, "MySQL", "root", "password"
> ODBC || MSDE || JDBC changes the values by adding free space to fill all
> the field's spaces (Instead of "MySQL" it adds "MySQL "). It
> seems like some component doesn't understand that I'm using varchar(20),
> not char.
> For instance, when I'm using mysql DB server, such problem doesn't
> introduce itself... Does anyone know how to manage this?
> Thank you,
> Audrius
When I tried to insert data into MSDE table using console, everything
worked fine. The data occupies exactly as it should ("MySQL" - 5
symbols). But when I do this using ODBC from my application, it doesn't
work right. Can anyone suggest me a solution?|||Audrius wrote:
> Audrius wrote:
>
>
> When I tried to insert data into MSDE table using console, everything
> worked fine. The data occupies exactly as it should ("MySQL" - 5
> symbols). But when I do this using ODBC from my application, it doesn't
> work right. Can anyone suggest me a solution?
The problem was solved.