?
Solved

Sybase ODBC driver supporting Nchar

Posted on 2004-08-18
8
Medium Priority
?
470 Views
Last Modified: 2012-05-05
Is there an ODBC driver for Sybase Adaptive Server Enterprise 12.0.0.4 for Windows XP that supports the Nchar and Nvarchar data types?
If so, how do I obtain the driver?

I am accessing a Sybase database via ADO using ODBC.  I get an error from my ODBC driver when I attempt to append a command parameter with ADO type adVarWChar.  The same query works when I use ADO type adVarChar.
0
Comment
Question by:Satyabodhi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 11851469
You should be using an OLEDB provider.  it should have come with your install.  Here is the connection string:

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForSybaseAdaptiveServerEnterprise

Leon
0
 
LVL 3

Author Comment

by:Satyabodhi
ID: 11852657
Leon,
We tried an OLEDB provider and it still fails with adVarWChar
Here is the code:
 conn.ConnectionString = "Provider=Sybase.ASEOLEDBProvider.2;Initial Catalog=john;User ID=tester;Password=test06;Data Source=oledbsybase;Persist Security Info=False"

  conn.Open
   cmd.CommandText = "Select * from foo where string = ?"
  cmd.ActiveConnection = conn
  Set p = New Parameter
  p.Value = "One"
'  p.Type = adVarChar
  p.Type = adVarWChar
  p.Direction = adParamInput
  p.Name = "String"
  p.Size = 20
  cmd.Parameters.Append p
  Set rs = cmd.Execute(c)

----- At this point we get the error "The given type name was unrecognized".
The same code succeeds with adVarChar.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 11852944
Try this:

conn.ConnectionString = "Provider=Sybase.ASEOLEDBProvider.2;Initial Catalog=john;User ID=tester;Password=test06;Data Source=oledbsybase;Persist Security Info=False"
conn.Open

strSQL = "Select * from foo where string = '" & strParam & "'"
rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 29

Expert Comment

by:leonstryker
ID: 11852952
Oops missed one:

conn.ConnectionString = "Provider=Sybase.ASEOLEDBProvider.2;Initial Catalog=john;User ID=tester;Password=test06;Data Source=oledbsybase;Persist Security Info=False"
conn.Open

strParam = "One"

strSQL = "Select * from foo where string = '" & strParam & "'"
rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
0
 
LVL 3

Author Comment

by:Satyabodhi
ID: 11853132
Yes, that would work, provided we escape all quote characters in the parameter strings (by doubling them).
But, it avoids the initial question of support for adWChar and adVarWChar.
With the solution of NOT using (?) question-mark parameter markers for string parameters you don't need OLEDB.  You can continue with ODBC.
We still need parameter markers, and the command object for date parameters, because we operate in multiple cultural zones.  Most of our queries that use datetime parameters also use string parameters and many use decimal parameters that have similar cultural differences in string representation.

This solution may be the ultimate answer but I am still hoping for something better.
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 500 total points
ID: 11853255
in that case you may want to try this:

strSQL = "Select * from foo where string = N'" & strParam & "'"

Leon
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question