Error to connect to SQL SERVER 2005 EXPRESS with Lazarus

Forum related to MS SQL Server

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Inka
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.02.2010, 21:35
Location: Nimes

Error to connect to SQL SERVER 2005 EXPRESS with Lazarus

Post by Inka »

Hi,

I have a problem on a database name ('Planning Groupe RDI'). This database name contains space in the name and when i try to connect with the TZComponent (i use Lazarus), i have this error :
"....
Impossible to find entry in sysdatabases for the database 'Planning'.
..."
It seems that the name of the database is truncated on the first space character.

I've do the same test with the same component in the same project, with a database which named 'Test', and i have no error. I can open the database.

Please, if someone can help me :roll:

I use :
- Lazarus 0.9.29
- ZeosLib 6.6.6-stable
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Try putting " (double quote) around the database name. No guantees, but it may help. Seems like this sign is used to quote identifiers with special characters in MSSQL. But I must say : I never used this database.

Mark
Image
Inka
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.02.2010, 21:35
Location: Nimes

Post by Inka »

Hi Mark,

Thanks for reply. I have already tried the double quote and simple quote around the database name like this :
'Planning Groupe RDI'
"Planning Groupe RDI"

But i've got an error which tell me that this is an unknown or invalid database.

If you have an other idea, i will take it
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Sorry,

I don't have an idea right now. I can't test and debug this myself.
But i've got an error which tell me that this is an unknown or invalid database.
I suppose this is the message coming from the server. Best thing to do is add a TZSQLMonitor to the project and log all statements sent to the server into a file when you try using different 'quoting systems'.
BTW : you best test this with runtime connection, not using design time connections.

Mark
Image
Inka
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.02.2010, 21:35
Location: Nimes

Post by Inka »

OK. I will try the test and i'll inform you.

I don't understand what you mean with runtime connection and design connection. Could you explain me ?
Inka
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.02.2010, 21:35
Location: Nimes

Post by Inka »

I've found the solution . The problem was in SQL Server 2005 configuration.
To solve this connection problem, we need two properties :
- first, in the TZConnection, you must put the database name between double quote like this : "Planning Groupe RDI"
- next, on the SQL Server 2005, in the properties of the instance, on the Connexion page, you must active the properties "quoted identifiers"

Bye.
Inka
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.02.2010, 21:35
Location: Nimes

Post by Inka »

Inka wrote:I've found the solution . The problem was in SQL Server 2005 configuration.
To solve this connection problem, we need two properties :
- first, in the TZConnection, you must put the database name between double quote like this : "Planning Groupe RDI"
- next, on the SQL Server 2005, in the properties of the instance, on the Connexion page, you must active the properties "quoted identifiers"

Bye.
The solution is the same in SQL Server 2008.
Post Reply