473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ODBC and MSDE

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

Jul 23 '05 #1
4 2662
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?

Jul 23 '05 #2
Audrius (au**************@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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
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

Jul 23 '05 #4
Audrius (au**************@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, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
6
by: Ernesto | last post by:
I hope this is not outside the scope of this newsgroup. have been useing BulkAdd with ms-access with good success. Until now that I;m switching to MSDE which is on a shared server. The...
4
by: Frank Bishop | last post by:
I have a MSDE database and I need to delete the contents of the exiting tables and then import new data on a scheduled basis from an ODBC data source (preferable through a system DSN). This was...
1
by: Zlatko Matić | last post by:
Hello. How can I call some functions on MSDE when working in Access (.mdb) that is connected to MSDE via ODBC linked tables ? Especially in-line functions, that I would like to use as recordset...
5
by: Zlatko Matić | last post by:
Hello. How can I call some functions on MSDE when working in .mdb ? Especially in-line functions which are similar to stored procedures. How can I use MSDE in-line functions as recordsource for...
10
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
0
by: Frank Bishop | last post by:
I need to write a VB.Net application in VS.net 2003 that copies several tables from an ODBC data source to MSDE tables. I do not have Enterprise Manager or DTS to use. Is there an example of this...
5
by: somersbar | last post by:
hello all, im trying to connect to a microsoft access database from an ASP.NET web form. i keep getting the following error though: ERROR Could not use '(unknown)'; file already in use....
1
by: mattias192 | last post by:
I cannot make sense of the ODBC error messages my VBA application throws at me. I connect to an Access database of about 500MB in size. First, there is the "Not enough space on temporary disk"....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.