• Home
  • History
  • Annotate
  • only in this directory
NameDateSize

..28-Aug-201234

framework-include.shH A D12-Jan-20093.6 KiB

iODBC/H28-Aug-20126

iodbc-config.macosxH A D12-Jan-20096 KiB

iodbc.expH A D12-Jan-20092.4 KiB

iODBCinst/H28-Aug-20126

iodbcinst.expH A D12-Jan-20091.3 KiB

iODBCtest/H28-Aug-20124

iODBCtestw/H28-Aug-20124

link-inclibs.shH A D12-Jan-20094.5 KiB

MakefileH A D12-Jan-20094.9 KiB

myodbc.configure.diffH A D12-Jan-20093.2 KiB

README.MYODBCH A D12-Jan-20095.9 KiB

README.MYODBC

1Objective: how to build MyODBC for Mac OS X and configure for use with iODBC
2
3Introduction
4============
5
6This readme file describes the steps required to build a MyODBC driver
7on Mac OS X.
8
9Before this driver can be built you need to install the current version of
10MySQL on your system. As building MySQL itself on Mac OS X falls outside
11the context of this readme, we suggest you download a Darwin binary from:
12
13	http://www.mysql.com/downloads/mysql-4.0.htm
14
15As of writing the version of this package is:
16
17	MySQL 4.0.14
18	MacOS X 10.2 (Darwin 6.x) (PowerPC) (7.4M)
19
20
21From the same site you can also download the latest MyODBC sources:
22
23	http://www.mysql.com/downloads/api-myodbc-3.51.html	
24
25As of writing the version of this package is:
26
27	MyODBC 3.51.06
28	Source Files (tar.gz) (314K)
29
30
31Unpack this source code into a new directory.
32
33There are who ways to build the MyODBC driver which we will both describe
34in detail below:
35
36
37Method 1 : using the iODBC frameworks
38=====================================
39
401.  Install iODBC framework version
41
42    Please read the file ../README.MACOSX for details on how to build
43    and install the framework version of iODBC.
44
45
462.  Setting up the MyODBC source tree.
47
48    To setup the MyODBC tree execute the following commands:
49
50	$ cd MyODBC-3.51.06
51
52
53    Then we can either use the supplied myodbc.configure.diff file from
54    the iODBC project using the command:
55
56	$ patch -p1 < myodbc.configure.diff
57
58    or edit the file configure manually and replace every occurrence of
59
60	String			Replace with
61
62	-liodbc			-framework iODBC
63	-liodbcinst		-framework iODBCinst
64	isql.h			iODBC/isql.h
65	isqlext.h		iODBC/isqlext.h
66	isqltypes.h		iODBC/isqltypes.h
67	sql.h			iODBC/sql.h
68	sqlext.h		iODBC/sqlext.h
69	sqltypes.h		iODBC/sqltypes.h
70	iodbcinst.h		iODBCinst/iodbcinst.h
71	
72
73    After this we configure the source code using the following
74    command:
75 
76	./configure --with-mysql-libs=XXX --with-mysql-includes=YYY
77
78    where XXX and YYY need to be replaced with the correct paths to the
79    MySQL libraries and header files.
80
81
82    Edit the file myodbc3.h and replace every occurrence of:
83
84	String			Replace with
85
86	isql.h			iODBC/isql.h
87	isqlext.h		iODBC/isqlext.h
88	isqltypes.h		iODBC/isqltypes.h
89	sql.h			iODBC/sql.h
90	sqlext.h		iODBC/sqlext.h
91	sqltypes.h		iODBC/sqltypes.h
92	iodbcinst.h		iODBCinst/iodbcinst.h
93
94
95    Edit the file myconf.h and make sure the following options are defined:
96
97	HAVE_IODBCINST_H
98	HAVE_ISQL_H
99	HAVE_ISQLEXT_H
100	HAVE_SQLGETPRIVATEPROFILESTRING
101
102    If any of these options are not defined, change the line from:
103
104	/* #undef HAVE_ISQL_H */
105
106    into:
107
108	#define HAVE_ISQL_H	1
109
110
111    Finally, you need to tell to the build process to link the MyODBC driver
112    against the iODBCinst framework. To achieve this goal, just edit the
113    driver/Makefile, make a search on libmyodbc3_la_LIBADD, and append
114    -Wl,-framework,iODBCinst at the end of this line.
115
116
1173.  Building the MyODBC driver
118
119    You can now execute the following command to build the driver:
120
121	$ make
122
123    As Mac OS X is only able to load at runtime only bundle libraries,
124    you need to use the following command to build the actual MyODBC
125    driver :
126
127	$ cd driver
128	$ cc -bundle -o libmyodbc.dylib *.lo -framework iODBCinst \
129	  -L/usr/local/mysql/lib/mysql -lmysqlclient -lz
130
131    Use this file libmyodbc.dylib as the driver.
132
133
134
135Method 2 : using the iODBC Unix libraries
136=========================================
137
1381.  Install iODBC Unix version
139 
140    The iODBC package can also be build as a normal Unix type package
141    using the following commands:
142
143	$ ./configure --prefix=/usr
144	$ make
145
146    followed by installing the library as root using the command:
147
148	# make install
149
150
1512.  Setting up the MyODBC source tree.
152
153    To setup the MyODBC tree execute the following commands:
154
155	$ cd MyODBC-3.51.06
156
157
158    After this we can configure the source code using the following 
159    command:
160 
161	./configure --with-mysql-libs=XXX --with-mysql-includes=YYY
162
163    where XXX and YYY need to be replaced with the correct paths to the
164    MySQL libraries and header files.
165
166
1673.  Building the MyODBC driver
168
169    You can now execute the following command to build the driver:
170
171	$ make
172
173    As Mac OS X is only able to load at runtime only bundle libraries,
174    you need to use the following command to build the actual MyODBC
175    driver :
176
177	$ cc -bundle -o libmyodbc.dylib *.lo -framework iODBCinst \
178	  -L/usr/local/mysql/lib/mysql -lmysqlclient -lz
179
180    Use this file libmyodbc.dylib to configure the driver in the next 
181    section.
182
183
184Configuring MyODBC Driver for use with iODBC
185=============================================
186
187To configure the MyODBC for use with iODBC the following actions should
188be performed:
189
1901.  From the MyODBC directory run the following command to install driver
191    in '/usr/local/lib' as user root:
192
193	$ cp libmyodbc.dylib /usr/local/lib
194
195
1962.  Configure the MyODBC Driver by adding the following lines to
197    /etc/odbcinst.ini:
198
199	[ODBC Drivers]
200	MyODBC Driver = Installed
201
202	[MyODBC Driver]
203	Driver = /usr/local/lib/libmyodbc.dylib
204
205
2063.  Configure MyODBC Driver ODBC DSN by adding the following lines to
207    either /etc/odbc.ini or $HOME/.odbc.ini:
208
209	[ODBC Data Sources]
210	MyODBCDSN = MyODBC Driver
211
212	[MyODBCDSN]
213	Driver = /usr/local/lib/libmyodbc.dylib
214	Port = 3306
215	UID = mysql
216
217     *** Please note that the DSN ie MyODBCDSN, must be the name of a
218         valid MySQL Database for the Database Server the connection
219         attempt is being made to.
220
221
2224.  A test connection can now be made to the MySQL Database using the
223    following sample program bundled with the iODBC SDK:
224
225	/usr/local/bin/odbctest
226	OpenLink ODBC Demonstration program
227	This program shows an interactive SQL processor
228
229	Enter ODBC connect string (? shows list): ?
230
231	DSN                            | Driver
232	---------------------------------------------------------------
233
234	MyODBCDSN                      | MyODBC Driver
235
236	Enter ODBC connect string (? shows list): 
237
238    Use the following string:
239
240	DSN=MyODBCDSN;UID=mysql;PWD=xxxx
241
242	Driver: 02.50.39 
243
244	SQL> select * from <table_name>
245
246