Could you suggest some manual for using ODBC.
I am interested in basic concepts and how to work with MySql server...


Thanks

Re: Manuel for ODBC by Cindy

Cindy
Tue Jun 22 14:22:10 CDT 2004

In news: O9b2nwHWEHA.1144@TK2MSFTNGP10.phx.gbl,
Predrag Milanovic <mpele@tesla.rcub.bg.ac.yu> wrote:
> Could you suggest some manual for using ODBC.
> I am interested in basic concepts and how to work with MySql
> server...

Hi Predrag,

Are you interested in ODBC itself, how to use an ODBC connection from VFP to
MySql, how to create views of MySql data, or how to send SQL Pass-through
commands to MySql to retrieve data?

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com




Re: Manuel for ODBC by Predrag

Predrag
Tue Jun 22 17:24:13 CDT 2004



> Are you interested in ODBC itself, how to use an ODBC connection from VFP
to
> MySql, how to create views of MySql data, or how to send SQL Pass-through
> commands to MySql to retrieve data?
>

I am interested in general philosophy of ODBC - how it works, because I
have problems to make connection.
For begining it would help how to create connection from VFP to MySql...


Thanks...




Re: Manuel for ODBC by Carsten

Carsten
Wed Jun 23 00:54:09 CDT 2004

Predag,

here is a snippet connecting to mySQL (without creating an ODBC-DSN).

<snip>

LOCAL lcDriver AS String
LOCAL lcHost AS String
LOCAL lcDatabase AS String
LOCAL lcUser AS String
LOCAL lcPwd AS String
LOCAL lcPort AS String

LOCAL lcConnString AS String

lcDriver= "MySQL ODBC 3.51 Driver"
lcHost= "fs-lin1"
lcDatabase= "test"
lcUser= "tamm"
lcPort= "3306" && Default
lcPwd= ""

lcConnString= 'Driver={' + lcDriver + '};'+;
'Server=' + lcHost + ';' + ;
'Port='+ lcPort + ';' + ;
'Option=11;Stmt=;' +;
'Database=' + lcDatabase + ';' + ;
'Uid=' + lcUser + ';'+ ;
'Pwd=;'

lnHandle= SQLStringConnect( lcConnString )
? lnHandle

IF lnHandle >= 0 THEN
? SQLExec( "select * from mytable where id = 123", "curTest" )
SQLDisconnect( lnHandle )
ENDIF

<snip>

Cheers
Carsten


"Predrag Milanovic" <mpele@tesla.rcub.bg.ac.yu> schrieb im Newsbeitrag
news:ewUuEfKWEHA.1356@TK2MSFTNGP09.phx.gbl...
>
>
> > Are you interested in ODBC itself, how to use an ODBC connection from
VFP
> to
> > MySql, how to create views of MySql data, or how to send SQL
Pass-through
> > commands to MySql to retrieve data?
> >
>
> I am interested in general philosophy of ODBC - how it works, because
I
> have problems to make connection.
> For begining it would help how to create connection from VFP to
MySql...
>
>
> Thanks...
>
>
>



Re: Manuel for ODBC by tnhoe

tnhoe
Wed Jun 23 17:49:10 CDT 2004

"Carsten Bonde"

What is the different of ODBC DSN and DSN less connection on VFP/MySQL ?

Regards
Hoe



Re: Manuel for ODBC by Carsten

Carsten
Wed Jun 23 04:53:34 CDT 2004

Hoe,

i'm not aware of any functional differences.
The way you use DSN-Less connections is in code a little different.
lnHandle= SQLConnect("DSN-Name")
instead of
SQLStringConnect(ConnectionString)

In my previous example the connectionsstring is created on the fly. In that
case the program must know the password. If security is an issue, this might
be a reason to use a DSN.
Maybe DSN's are easier to use when you have a DBC (with remoteviews) or
CursorAdaptors. I have less expierence with that one.

Instead of setting up the connectionstring, you can use the API-Function
CreateDSN.
Goes like this:

<snip>
PROCEDURE CreateDsn
LOCAL settings

DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, Integer,
String, String

settings="DSN=TestMySQL"+chr(0)+;
"Description=MySQL DSN"+chr(0)+;
"DATABASE=test"+chr(0)+;
"SERVER=192.168.100.254"+chr(0)+;
"UID=username"+chr(0)+;
"PASSWORD=secret"

Note: OS <= Win98, use the old driver "MySQL", on other systems
Note: use the current driver: "MySQL ODBC 3.51 Driver"
IF OS(3) >= "5"
=SQLConfigDataSource(0,1,"MySQL ODBC 3.51 Driver",settings)
ELSE
=SQLConfigDataSource(0,1,"MySQL",settings)
ENDIF

<snip>


Cheers
Carsten


"tnhoe" <tnhoe@pc.jaring.my> schrieb im Newsbeitrag
news:cbbcf2$alc$1@news4.jaring.my...
> "Carsten Bonde"
>
> What is the different of ODBC DSN and DSN less connection on VFP/MySQL ?
>
> Regards
> Hoe
>
>



Re: Manuel for ODBC by Anders

Anders
Wed Jun 23 06:14:40 CDT 2004

>> If security is an issue, this might
> be a reason to use a DSN.
On the contrary. With a connectionstring you can have the user enter the
password just in time and its' not stored anywhere.
-Anders

"Carsten Bonde" <bonde AT real-inkasso DOT de> wrote in message
news:eQH6zfQWEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hoe,
>
> i'm not aware of any functional differences.
> The way you use DSN-Less connections is in code a little different.
> lnHandle= SQLConnect("DSN-Name")
> instead of
> SQLStringConnect(ConnectionString)
>
> In my previous example the connectionsstring is created on the fly. In
that
> case the program must know the password. If security is an issue, this
might
> be a reason to use a DSN.
> Maybe DSN's are easier to use when you have a DBC (with remoteviews) or
> CursorAdaptors. I have less expierence with that one.
>
> Instead of setting up the connectionstring, you can use the API-Function
> CreateDSN.
> Goes like this:
>
> <snip>
> PROCEDURE CreateDsn
> LOCAL settings
>
> DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, Integer,
> String, String
>
> settings="DSN=TestMySQL"+chr(0)+;
> "Description=MySQL DSN"+chr(0)+;
> "DATABASE=test"+chr(0)+;
> "SERVER=192.168.100.254"+chr(0)+;
> "UID=username"+chr(0)+;
> "PASSWORD=secret"
>
> Note: OS <= Win98, use the old driver "MySQL", on other systems
> Note: use the current driver: "MySQL ODBC 3.51 Driver"
> IF OS(3) >= "5"
> =SQLConfigDataSource(0,1,"MySQL ODBC 3.51 Driver",settings)
> ELSE
> =SQLConfigDataSource(0,1,"MySQL",settings)
> ENDIF
>
> <snip>
>
>
> Cheers
> Carsten
>
>
> "tnhoe" <tnhoe@pc.jaring.my> schrieb im Newsbeitrag
> news:cbbcf2$alc$1@news4.jaring.my...
> > "Carsten Bonde"
> >
> > What is the different of ODBC DSN and DSN less connection on VFP/MySQL ?
> >
> > Regards
> > Hoe
> >
> >
>
>


Re: Manuel for ODBC by Predrag

Predrag
Wed Jun 23 10:54:41 CDT 2004

>
> here is a snippet connecting to mySQL (without creating an ODBC-DSN).
>
> <snip>
>
> LOCAL lcDriver AS String
> LOCAL lcHost AS String


Excellent, this is what I needed. And one more question: is it posible
to create view with this kind of connection?



Thanks




Re: Manuel for ODBC by Cindy

Cindy
Wed Jun 23 17:04:10 CDT 2004

In news: uWtt4tTWEHA.3640@TK2MSFTNGP11.phx.gbl,
Predrag Milanovic <mpele@tesla.rcub.bg.ac.yu> wrote:
>.... is it posible to create view with this kind of connection?

Hi Predrag,

Are you creating a VFP view of the SQL data or a new view on your MySQL
database? For a VFP view look at the Create SQL View command. For a view on
your MySQL database you'll need to pass the Create View command through as
a text string command in whatever subset/superset of the standard SQL that
your database understands.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com