home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / databases / sybase-faq / part15 < prev    next >
Encoding:
Internet Message Format  |  2004-04-21  |  16.8 KB

  1. Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
  2. Message-ID: <databases/sybase-faq/part15_1082468590@rtfm.mit.edu>
  3. Supersedes: <databases/sybase-faq/part15_1074677126@rtfm.mit.edu>
  4. Expires: 2 Aug 2004 13:43:10 GMT
  5. References: <databases/sybase-faq/part1_1082468590@rtfm.mit.edu>
  6. X-Last-Updated: 2003/03/02
  7. From: dowen@midsomer.org (David Owen)
  8. Newsgroups: comp.databases.sybase,comp.answers,news.answers
  9. Subject: Sybase FAQ: 15/19 - Open Client
  10. Reply-To: dowen@midsomer.org (David Owen)
  11. Followup-To: comp.databases.sybase
  12. Distribution: world
  13. Organization: Midsomer Consultants Inc.
  14. Approved: news-answers-request@MIT.EDU
  15. Keywords: FAQ, DATABASES, SYBASE, ASA, ASE, REP
  16. Originator: faqserv@penguin-lust.MIT.EDU
  17. Date: 20 Apr 2004 13:45:13 GMT
  18. Lines: 337
  19. NNTP-Posting-Host: penguin-lust.mit.edu
  20. X-Trace: 1082468713 senator-bedfellow.mit.edu 578 18.181.0.29
  21. Xref: senator-bedfellow.mit.edu comp.databases.sybase:106213 comp.answers:56959 news.answers:270299
  22.  
  23. Archive-name: databases/sybase-faq/part15
  24. URL: http://www.isug.com/Sybase_FAQ
  25. Version: 1.7
  26. Maintainer: David Owen
  27. Last-modified: 2003/03/02
  28. Posting-Frequency: posted every 3rd month
  29.    A how-to-find-the-FAQ article is posted on the intervening months.
  30.  
  31.                                   Open Client                                  
  32.                                                                                
  33.  
  34.  
  35.     7.1    What is Open Client?
  36.     7.2    What is the difference between DB-lib and CT-lib?
  37.     7.3    What is this TDS protocol?
  38.     7.4    I have upgraded to MS SQL Server 7.0 and can no longer connect from
  39.     Sybase's isql.
  40.     7.5    The Basics of Connecting to Sybase
  41.     7.6    Connecting to ASE using ODBC
  42.     7.7    Which version of Open Client works with which ASE?
  43.     7.8    How do I tell the version of Open Client I am running?
  44.    
  45. Freeware Useful SQL Tricks ASE FAQ
  46.  
  47. -------------------------------------------------------------------------------
  48.  
  49. 7.1: What is Open Client?
  50.  
  51. -------------------------------------------------------------------------------
  52.  
  53. Open Client is the interface (API) between client systems and Sybase servers.  
  54. Fundamentally, it comes in two forms:
  55.  
  56. Runtime
  57.  
  58. The runtime version is a set of dynamic libraries (dlls on W32 platforms) that
  59. allow client applications to connect to Sybase and Microsoft servers, or, in
  60. fact, any server that implements the Tabular Data Streams (TDS) protocol.  You
  61. need some form of Open Client in order to be able to connect to ASE in any way,
  62. shape or form.   Even if you are running isql on exactly the same machine as
  63. ASE itself, communication will still be via Open Client.  That is not to say
  64. that client to server communication on the same machine will go via the
  65. physical network, that decision is left entirely to the protocol implementation
  66. on the machine in question.
  67.  
  68. Development
  69.  
  70. The development version contains all of the libraries from the runtime version,
  71. plus the header files and other files, library files etc, that enable
  72. developers to build client apps that are able to connect to Sybase servers.
  73.  
  74. Back to top
  75.  
  76. -------------------------------------------------------------------------------
  77.  
  78. 7.2: What is the difference between DB-lib and CT-lib?
  79.  
  80. -------------------------------------------------------------------------------
  81.  
  82. Both DB-lib and CT-lib are libraries that implement the TDS protocol from the
  83. client side. 
  84.  
  85. DB-lib
  86.  
  87. DB-lib was Sybase's first version.  It was a good first attempt, but has/had a
  88. number of inconsistencies.  There are, or possibly were, a lot of applications
  89. written using DB-lib.  If you are about to start a new Open Client development,
  90. consider using CT-lib, it is the preferred choice.  (What version of TDS does
  91. DB-lib, is it only 4.2?)
  92.  
  93. Having said that you should use CT-lib for new developments, there is one case
  94. that this may not be true for and that is 2 phase commit.  2 phase commit is
  95. supported directly by DB-lib but is not supported directly by CT-lib.
  96.  
  97. CT-lib
  98.  
  99. CT-lib is a completely re-written version of Open Client that was released in
  100. the early '90s.  The API is totally different from DB-lib, and is much more
  101. consistent.  Applications written using DB-lib cannot simply be compiled using
  102. CT-lib, they need a significant amount of porting effort.   CT-lib is newer,
  103. more consistent and, in several people's opinions, including mine, slightly
  104. longer winded.  Having said that, the future of DB-lib is uncertain and is
  105. certainly not being developed any more, as a result all new apps should be
  106. written using CT-lib.
  107.  
  108. Back to top
  109.  
  110. -------------------------------------------------------------------------------
  111.  
  112. 7.3: What is this TDS protocol?
  113.  
  114. -------------------------------------------------------------------------------
  115.  
  116. Tabular Data Streams or TDS is the name given to the protocol that is used to
  117. connect Sybase clients with Sybase servers.  A specification for the protocol
  118. can be obtained from Sybase, I had a copy but cannot seem to find it now.
  119.  
  120. The is a project that is reverse engineering the protocol and building a set of
  121. libraries independent of either Sybase or Microsoft, but able to connect to
  122. either of their servers.  FreeTDS is a considerable way down the line, although
  123. I do not believe that it is production ready yet!
  124.  
  125. As part of the project, they have started to document the protocol, and a view
  126. of TDS 5.0 can be seen here.
  127.  
  128. Back to top
  129.  
  130. -------------------------------------------------------------------------------
  131.  
  132. 7.4: I have upgraded to MS SQL Server 7.0 and can no longer connect from
  133. Sybase's isql.
  134.  
  135. -------------------------------------------------------------------------------
  136.  
  137. Microsoft SQL Server has always supported the TDS protocol, and up to release 7
  138. it has been the primary means of communication between clients and servers. 
  139. With release 7, TDS has been reduced to being a "legacy" protocol.  (I do not
  140. know what the communication protocol/mechanism with release 7 is, you will need
  141. to talk to someone from Microsoft or search comp.databases.ms-sqlserver .)
  142.  
  143. In order to connect to MS Sql Server 7 using Sybase's Open Client you will need
  144. to install Service Pack 2 of SQL Server 7, available from http://
  145. www.microsoft.com.
  146.  
  147. Back to top
  148.  
  149. -------------------------------------------------------------------------------
  150.  
  151. 7.5:    The Basics of Connecting to Sybase
  152.  
  153. -------------------------------------------------------------------------------
  154.  
  155. The following describes how to connect to Sybase ASE on a UNIX machine from a
  156. windows client with isql etc.  The specific example is Sybase ASE 11.9 on
  157. Redhat Linux 6.1, using Windows 95 and NT.  (Have both on partitions and the
  158. process was the same... This is not a technical review or an in-depth
  159. discussion (there are people far more qualified than me for that ;-) ).  Rather
  160. it is more along the lines of "This is how I managed it, it should work for
  161. you". As always there are no guarantees, so it if goes wrong, it's your fault
  162. [<g>].
  163.  
  164. The starting point for this discussion has to be, you've downloaded (or
  165. whatever means you used to acquire it) both Sybase ASE for Linux and the PC
  166. Client software (a big zip file) and are ready to install. I'm not going to
  167. discuss the install process as Sybase managed to do a good job of that, so
  168. I'm leaving well alone. The bit you have to take notice of is when you run
  169. srvbuild. This should happen the first time you log on as the user sybase after
  170. the install.  If it doesn't then you can run it by hand after, it line in the
  171. $SYBASE directory under bin. The reason why I'm mentioning this is that
  172. srvbuild defaults to installing your database using the name "localhost". Now
  173. the problem with localhost is that it is kind of a special case and would mean
  174. that you could not connect to your database from anywhere other that the server
  175. itself. This would defeat the object of this
  176. discussion, so simply name it something else, bob, george, albert, mydatabase,
  177. whatever, the choice is yours.
  178.  
  179. Having done this (it takes a while to complete) you should now have a running
  180. database. so try to connect to it on the local machine with something like isql
  181. -SServerName -Usa, (where ServerName is whatever you called it when you ran
  182. srvbuild) when it asks for a password, just press enter and you should be
  183. greeted by the monumentous welcome 
  184.  
  185. 1>
  186.  
  187. Not a lot for all the work you have done to get to this point, but you've
  188. connected to your database and that's the main thing. This is very important as
  189. not only does this mean that your database is working, but it also means that
  190. the server half of Open Client is working. This is because even isql on the
  191. server connects to the database using Open Client and you've just proved it
  192. works, cool. Next run dsedit on the server and make a note of the following 3
  193. things:
  194.  
  195.     1: The server name
  196.     2: The IP address
  197.     3: The port
  198.    
  199. Your going to need these to get connected from windows.
  200.  
  201. Now switch to you windows machine, did I remember to tell you to shut down
  202. dsedit on the server?, consider it said ;-). Unpack the PC Client software zip
  203. file and install it using the instructions that came with it. They worked fine
  204. for me and I'm an idiot, so they should work for you. When you've finished, go
  205. to the start menu and start dsedit (on my machine it's under programs ->
  206. sybase). When it runs, it begins with a dialog asking you which Interface
  207. driver to open, I've done this 3 times and went with the default every time, so
  208. it should be a safe bet. At this point you can now add your Linux based server.
  209. Select the menu item serverobject->add. Then enter the name of the server you
  210. just got from your Linux box, in the field labeled "server". It is probably a
  211. good idea that it is the same name you got from your Linux based dsedit to
  212. ensure that everyone is referring to the same server with the same name. 
  213. Prevents confusion.  This then opens a new window with several fields, one of
  214. which is the server name you just entered. The bottom field is the bit where
  215. you enter the "nitty gritty", the server IP address and port. To do this right
  216. click on the field and select "modify attribute" to open the server address
  217. dialog. When this new dialog opens click add to open yet another dialog (is
  218. there an award for the most gratuitous use of the word dialog???). OK, this is
  219. the last one, honest. Leave the drop down list where it is (hopefully showing
  220. TCP/IP or something similar). Instead move straight to the address field and
  221. enter the following: the Linux servers IP address followed by the port number
  222. (the one from the server dsedit), separated by a comma. On my machine it looks
  223. like this.
  224.  
  225. 192.0.0.2,2501
  226.  
  227. Now you can "OK" your way back out of the dialogs, back up to where you started
  228. from and exit dsedit. Then launch isql on the windows box and log in.
  229. Personally I did this from a DOS prompt, using exactly the same syntax I did on
  230. the Linux box, but that's just because I like it that way.  Now you should be
  231. happily querying you Linux (or other UNIX for that matter) based Sybase ASE
  232. database. What you do with it now, is covered elsewhere in this FAQ from people
  233. able to tell you, unlike me. Now just one more time for good measure, I'm going
  234. to type the word, wait for it.... Dialog.
  235.  
  236. Back to top
  237.  
  238. -------------------------------------------------------------------------------
  239.  
  240. 7.6: Connecting to ASE Using OLTP
  241.  
  242. -------------------------------------------------------------------------------
  243.  
  244. To begin with you need to be certain that you can connect to your Linux hosted
  245. Sybase ASE database from your windows based machine. Do this by running isql
  246. from your Linux box and connect to the database, if this works, then your all
  247. set (See Q7.5). You will need the Sybase ODBC driver, this came with the PC
  248. Client package. If you got your Windows Open Client software through some other
  249. means, then you may need to down load the ODBC driver, this will become
  250. apparent later. Right, begin by launching the 32 bit ODBC administrator, either
  251. from the Sybase menu under start -> programs or the control panel. Ensure that
  252. you are displaying the "user DSN" section (by clicking on the appropriate tab).
  253.  
  254. You can then click on the button labeled add to move to the driver selection
  255. dialog. Select Sybase System 11 and click on finish. You will by now have
  256. noticed that this is Microsoft's way of taunting you and you haven't actually
  257. finished yet, you're actually at the next dialog. What you have actually done
  258. is told windows that you are now about to configure your Sybase ODBC driver.
  259. There are 4 boxes on the dialog with which you are now presented, and they are:
  260.  
  261.     Data Source Name
  262.     Description
  263.     Server Name
  264.     Database Name
  265.    
  266. The data source name is the Server name from your interfaces file on your Linux
  267. server. If you are uncertain of any of these values, then log onto your Linux
  268. box, run dsedit and take a look. It will only take you 2 minutes and much
  269. easier than debugging it later. The description field is irrelevant and you can
  270. put anything in there that is meaningful to you.  Server name is the IP address
  271. of the Linux server, that is hosting your database. Database name is the name
  272. of a database to which you want to connect, once your Sybase connection has
  273. been established.  If in doubt, you can stick master in there for now, at least
  274. you'll get a connection.  Now you can click on OK to get back to the starting
  275. screen, followed by another OK to exit ODBC administrator. We will now test the
  276. connection by running Sybase Central. I chosen this because I figure that if
  277. you downloaded the PC Client package, then I know you've got it (at least I'm
  278. fairly sure). When you launch Sybase administrator from start->programs->
  279. Sybase, you are presented with a connection dialog. There are 3 fields in this
  280. box
  281.  
  282.     User ID
  283.     Password
  284.     Server Name
  285.    
  286. In the field labeled UserID, you can type in sa. If you've been doing some work
  287. on Sybase through other means and you have already created a valid user, then
  288. you can use him (her, it, whatever). In the password field, type in the
  289. appropriate password. Assuming you have changed nothing from the
  290. original Sybase install and you are using sa, then you will leave this blank.
  291. The final field is a dropdown list box containing all the Sybase remote
  292. connections you have. Assuming you only have the one, then you can leave this
  293. alone. If you have more than one, stick to the one that you know works for now
  294. and that allows access to the user you've used. In simple English (and if you
  295. don't speak English, then I hope somebody has translated it :-) ). If this is a
  296. clean install and you have altered nothing after following the instruction
  297. earlier to establish an Open Client, then the top box should contain simply
  298. "sa", the middle box should be blank, and the bottom list-box should contain
  299. whatever the servername is in your Linux based interfaces file. Clicking on OK
  300. will now connect Sybase Central to the database and "away you go"...
  301.  
  302. Hope this is of some assistance to you, but if you run into problems then I
  303. suggest you post to the newsgroup, which is where the real experts hang out. I
  304. am unlikely to be able to help you, as I have simply noted down my experiences
  305. as I encountered them, in the hope they may help somebody out.
  306. I take no responsibility for anything, including any result of following the
  307. instructions in this text.
  308. Good luck...
  309.  
  310. Jim
  311.  
  312. Back to top
  313.  
  314. -------------------------------------------------------------------------------
  315.  
  316. 7.7: Which version of Open Client works with which ASE?
  317.  
  318. -------------------------------------------------------------------------------
  319.  
  320. The TDS protocol that *is* Open Client is built so that either the client or
  321. server will fallback to a common dialect. I suppose that it is theoretically
  322. possible that both would fallback for some reason, but it seems unlikely. I was
  323. recently working with a client that was using Open/Client 4.2 to speak to a
  324. version 11.5 ASE using Powerbuilder 3 and 4! Amazing, it all worked! The main
  325. problem that you will encounter is not lack of communication but lack of
  326. features. The facility to bcp out of views was added to the 11.1.1 release. You
  327. will still be able to connect to servers with old copies of Open/Client, you
  328. just won't have all of the features.
  329.  
  330. There is also another fairly neat feature of the later releases of Open/Client,
  331. it has a very good compatibility mode for working with old applications. The
  332. client that was running Open/Client 4.2 with Powerbuilder 3 is now connecting
  333. to the database using version 11.1.1. Which is not bad when you remember that
  334. Powerbuilder 3 only talked 4.2 DBLib!
  335.  
  336. Back to top
  337.  
  338. -------------------------------------------------------------------------------
  339.  
  340. 7.8: How do I tell the version of Open Client I am running?
  341.  
  342. -------------------------------------------------------------------------------
  343.  
  344. Run
  345.  
  346. isql -v
  347.  
  348. from the command line, will return a string like:
  349.  
  350. Sybase CTISQL Utility/11.1.1/P-EBF7729/PC Intel/1/ OPT/Thu Dec 18 01:05:29 1997
  351.  
  352. The 11.1.1 part represents the version number.
  353.  
  354. Back to top
  355.  
  356. -------------------------------------------------------------------------------
  357.  
  358. Freeware Useful SQL Tricks ASE FAQ
  359.  
  360.