Hyphen in DB Name

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Hyphen in DB Name

Post by xnadeem » Tue 09 Jul 2019 12:52

Hi,

I am facing an issue where I am trying to execute a stored procedure with no parameters and the Database name has got a hyphen in it. The Stored procedure does not execute and there is an SQL exception complaining about invalid character "-" in the query

Drilling down the DevArt code I have seen that the issue is in function "GetSqlForSysProcedureParameters"

The query thats being fired is trying to get the parameters but having DB name with hyphen and hence its failing. I am guessing it should simply amend the db name by adding "[" and "]"

Can this issue be looked at please

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Wed 10 Jul 2019 07:46

Please try to set the UseQuoteChar parameter to True in the connection settings. For example:

SQLConnection1.Params.Values['UseQuoteChar'] := 'True';

xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Re: Hyphen in DB Name

Post by xnadeem » Mon 15 Jul 2019 10:41

Hi,

I am using below code. As recommended setting 'UseQuoteChar' to true didn't work. The issue is the same as described in original post function "GetSqlForSysProcedureParameters" has the SQL query which throws SQL exception as DB is passed with a hyphen.

So If DB name is "N-CFG" it creates parameters as "N-CFG.dbo" which is incorrect. It should provided as [N-CFG].dbo

Please let me know if there is a workaround for this

Cheers

SQLDB := TSQLConnection.Create(nil);
SQLDB.LoginPrompt := False;
SQLDB.ConnectionName := 'MSSQLConnection';
SQLDB.DriverName := 'DevartSQLServer';
SQLDB.GetDriverFunc := 'getSQLDriverSQLServer';
SQLDB.LibraryName := 'dbexpsda40.dll';
SQLDB.VendorLib := 'sqlncli11';

SQLDB.Params.Values['UseQuoteChar'] := 'True';

SQLDB.Params.Values['Database'] := dbname;
SQLDB.Params.Values['User_name'] := username;
SQLDB.Params.Values['Password'] := password;
SQLDB.Params.Values['Hostname'] := hostname;
Last edited by xnadeem on Tue 16 Jul 2019 09:11, edited 1 time in total.

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Tue 16 Jul 2019 08:59

Unfortunately, we can't reproduce the issue. To investigate this behavior of dbExpress driver for SQL Server, please compose a small sample demonstrating the issue and send it to us, including database object creation scripts.
You can send the sample by using the contact form at our site: devart.com/company/contactform.html

Also, please specify the version of dbExpress driver for SQL Server you are using.

xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Re: Hyphen in DB Name

Post by xnadeem » Tue 16 Jul 2019 09:13

Hi,

to reproducer this you need to have a stored procedure with no parameters and DB name should have hyphen. Only then executing this stored procedure will recreate the issue. I hope you are doing the same

Cheers

Also will be providing you the code in question

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Thu 18 Jul 2019 08:52

Thank you for the information. We have fixed the issue, and the fix will be included in the next dbExpress driver for SQL Server build.

xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Re: Hyphen in DB Name

Post by xnadeem » Thu 18 Jul 2019 09:03

Any Idea when this new build will be available Please?

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Thu 18 Jul 2019 12:55

We can provide you with a nightly build of dbExpress driver for SQL Server Trial Edition with the latest fixes. Please send us a corresponding request via the e-support form on our website (devart.com the "Support"\"Request Support" menu)

xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Re: Hyphen in DB Name

Post by xnadeem » Thu 08 Aug 2019 07:10

Hi,

We have got the nightly build and it seems to be working fine. Please can you let us know when can we have official release for this fix? We have customer waiting for this fix

Regards

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Thu 08 Aug 2019 13:35

We're planning to release a new version of dbExpress driver for SQL Server next week.

xnadeem
Posts: 6
Joined: Tue 09 Jul 2019 12:11

Re: Hyphen in DB Name

Post by xnadeem » Thu 08 Aug 2019 13:46

Hi,

Thanks for the reply. Please let us know what is the process of getting the update? Do we have to renew the subscription to get the update?

Stellar
Devart Team
Posts: 304
Joined: Tue 03 Oct 2017 11:00

Re: Hyphen in DB Name

Post by Stellar » Fri 09 Aug 2019 07:33

During the subscription period (it is active for one year after the product purchase or its renewal), you have access to the latest versions of the product and all bug fixes. Technical support of the product is provided regardless of the subscription term, but you can have access to the latest versions, including the latest fixes, only with an active subscription.

samadmahmud
Posts: 1
Joined: Tue 13 Aug 2019 14:23

Re: Hyphen in DB Name

Post by samadmahmud » Tue 13 Aug 2019 14:27

Hi
Do we have a date for the fix to be available?
Thanks

ViktorV
Devart Team
Posts: 2723
Joined: Wed 30 Jul 2014 07:16

Re: Hyphen in DB Name

Post by ViktorV » Wed 14 Aug 2019 14:06

The new build of dbExpress driver for SQL Server 8.0.1 that includes the fix is already available for download.
Please check the operation of this build and let us know the result.

Post Reply