connection issue

connection issue

am 26.07.2005 11:58:43 von Mark Mchugh

Hi,
I am using the following connection, which i use when
my application starts


Set connMySQL = New ADODB.Connection
connMySQL.ConnectionString = "DRIVER={mySQL ODBC
3.51 Driver};" _
& "SERVER=192.168.0.55;" _
& "DATABASE=test;" _
& "UID=root;" _
& "PWD=;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

connMySQL.CursorLocation = adUseClient

connMySQL.Open




and then in any other form, i use this to access the
datebase

Set rs = New ADODB.Recordset
rs.ActiveConnection = connMySQL
rs.Open sqlstr, connMySQL, adOpenStatic,
adLockOptimistic



so, for example, if i start my application, and leave
it running for a while ( doing nothing ) and then try
use a funtion to access the database, it does not
work. I presume this is because the connection has
timed out?

is there a better way of handling this? i dont think
its wize just in increase the timeout on the database?



thanks

Mark

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: connection issue

am 26.07.2005 15:52:44 von Daniel da Veiga

I use two functions, both public, one for open and one for close the
connection, and call them just before any db operation, I guess this
is safer. Setting the interactive timeout is the other way to do it.

On 7/26/05, Mark Mchugh wrote:
> Hi,
> I am using the following connection, which i use when
> my application starts
>=20
>=20
> Set connMySQL =3D New ADODB.Connection
> connMySQL.ConnectionString =3D "DRIVER=3D{mySQL ODBC
> 3.51 Driver};" _
> & "SERVER=3D192.168.0.55;" _
> & "DATABASE=3Dtest;" _
> & "UID=3Droot;" _
> & "PWD=3D;" _
> & "OPTION=3D" & 1 + 2 + 8 + 32 + 2048 + 16384
>=20
> connMySQL.CursorLocation =3D adUseClient
>=20
> connMySQL.Open
>=20
>=20
>=20
>=20
> and then in any other form, i use this to access the
> datebase
>=20
> Set rs =3D New ADODB.Recordset
> rs.ActiveConnection =3D connMySQL
> rs.Open sqlstr, connMySQL, adOpenStatic,
> adLockOptimistic
>=20
>=20
>=20
> so, for example, if i start my application, and leave
> it running for a while ( doing nothing ) and then try
> use a funtion to access the database, it does not
> work. I presume this is because the connection has
> timed out?
>=20
> is there a better way of handling this? i dont think
> its wize just in increase the timeout on the database?
>=20
>=20
>=20
> thanks
>=20
> Mark
>=20
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>=20
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe: http://lists.mysql.com/win32?unsub=3Ddanieldaveiga@gma=
il.com
>=20
>=20


--=20
Daniel da Veiga
Computer Operator - RS - Brazil

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

RE: connection issue

am 26.07.2005 16:08:00 von bullijr

------=_NextPart_000_004C_01C591C9.E76C84F0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Another option that you have to really increase your security (and decrease
your code) is to create system DSNs. When you do this, you only have to call
the DSN instead of passing the server IP, username, and password over the
ASP.

For example, if you created a DSN, your code would change to:


Set connMySQL = Server.CreateObject("ADODB.Connection")
connMySQL.Open "DSN=<>"
connMySQL.CursorLocation = adUseClient

Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open sqlstr, connMySQL, adOpenStatic, adLockOptimistic



See how much less that is? Plus, unless you are using SSIs, you would have
to write out that long connection string everytime you open your connMySQL.

Just some other ideas for you...

J.R.

-----Original Message-----
From: Daniel da Veiga [mailto:danieldaveiga@gmail.com]
Sent: Tuesday, July 26, 2005 9:53 AM
To: MySQL Win32 List
Subject: Re: connection issue

I use two functions, both public, one for open and one for close the
connection, and call them just before any db operation, I guess this is
safer. Setting the interactive timeout is the other way to do it.

On 7/26/05, Mark Mchugh wrote:
> Hi,
> I am using the following connection, which i use when my application
> starts
>
>
> Set connMySQL = New ADODB.Connection
> connMySQL.ConnectionString = "DRIVER={mySQL ODBC
> 3.51 Driver};" _
> & "SERVER=192.168.0.55;" _
> & "DATABASE=test;" _
> & "UID=root;" _
> & "PWD=;" _
> & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
>
> connMySQL.CursorLocation = adUseClient
>
> connMySQL.Open
>
>
>
>
> and then in any other form, i use this to access the datebase
>
> Set rs = New ADODB.Recordset
> rs.ActiveConnection = connMySQL
> rs.Open sqlstr, connMySQL, adOpenStatic, adLockOptimistic
>
>
>
> so, for example, if i start my application, and leave it running for a
> while ( doing nothing ) and then try use a funtion to access the
> database, it does not work. I presume this is because the connection
> has timed out?
>
> is there a better way of handling this? i dont think its wize just in
> increase the timeout on the database?
>
>
>
> thanks
>
> Mark
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe:
http://lists.mysql.com/win32?unsub=danieldaveiga@gmail.com
>
>


--
Daniel da Veiga
Computer Operator - RS - Brazil

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=bullijr@innovatim.com


------=_NextPart_000_004C_01C591C9.E76C84F0
Content-Type: application/x-pkcs7-signature;
name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="smime.p7s"

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEH AQAAoIIIyzCCAlMw
ggG8oAMCAQICAw2wbDANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTEl MCMGA1UEChMcVGhh
d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBl cnNvbmFsIEZyZWVt
YWlsIElzc3VpbmcgQ0EwHhcNMDQxMjI1MDU1MDI3WhcNMDUxMjI1MDU1MDI3 WjBHMR8wHQYDVQQD
ExZUaGF3dGUgR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0GCCqGSIb3DQMC AgEoMAcGBSsOAwIa
MAoGCCqGSIb3DQIFMHgGCSsGAQQBgjcQBDFrMGkwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRo
YXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVl
bWFpbCBJc3N1aW5nIENBAgMNsGwwegYLKoZIhvcNAQkQAgsxa6BpMGIxCzAJ BgNVBAYTAlpBMSUw
IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQD EyNUaGF3dGUgUGVy
c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIDDbBsMA0GCSqGSIb3DQEBAQUA BIGAr9d4RMYgmzY2
cnm6shVDGn6N0CttCQfidL8hDYNnr2BBb2bB1CQ6wpBtqlgNCheJooVOLZCQ puSCDNGnYRayQ5V2
E/w+g/RUqHxK1syHbt1SNxtJnaP983V6JD/f7j7IWkECVhlolnIrx0wVhSbi Amrg/ubvZi0iYbCS
aBBwSf0AAAAAAAA=

------=_NextPart_000_004C_01C591C9.E76C84F0--

Re: connection issue

am 26.07.2005 16:16:49 von Daniel da Veiga

Yeas, a good option, but if you'll run your app in many workstations,
you'll have to install the DSN in every machine it will run, that file
DSN thing never worked for me, and in fact, I droped ODBC long ago
after suffering a lot (It's MHO), switched to a standalone dll.

Good luck.

On 7/26/05, J.R. Bullington wrote:
> Another option that you have to really increase your security (and decrea=
se
> your code) is to create system DSNs. When you do this, you only have to c=
all
> the DSN instead of passing the server IP, username, and password over the
> ASP.
>=20
> For example, if you created a DSN, your code would change to:
>
>=20
> Set connMySQL =3D Server.CreateObject("ADODB.Connection")
> connMySQL.Open "DSN=3D<>"
> connMySQL.CursorLocation =3D adUseClient
>=20
> Set rs =3D Server.CreateObject("ADODB.RecordSet")
> rs.open sqlstr, connMySQL, adOpenStatic, adLockOptimistic
>=20
>
>=20
> See how much less that is? Plus, unless you are using SSIs, you would hav=
e
> to write out that long connection string everytime you open your connMySQ=
L.
>=20
> Just some other ideas for you...
>=20
> J.R.
>=20
> -----Original Message-----
> From: Daniel da Veiga [mailto:danieldaveiga@gmail.com]
> Sent: Tuesday, July 26, 2005 9:53 AM
> To: MySQL Win32 List
> Subject: Re: connection issue
>=20
> I use two functions, both public, one for open and one for close the
> connection, and call them just before any db operation, I guess this is
> safer. Setting the interactive timeout is the other way to do it.
>=20
> On 7/26/05, Mark Mchugh wrote:
> > Hi,
> > I am using the following connection, which i use when my application
> > starts
> >
> >
> > Set connMySQL =3D New ADODB.Connection
> > connMySQL.ConnectionString =3D "DRIVER=3D{mySQL ODBC
> > 3.51 Driver};" _
> > & "SERVER=3D192.168.0.55;" _
> > & "DATABASE=3Dtest;" _
> > & "UID=3Droot;" _
> > & "PWD=3D;" _
> > & "OPTION=3D" & 1 + 2 + 8 + 32 + 2048 + 16384
> >
> > connMySQL.CursorLocation =3D adUseClient
> >
> > connMySQL.Open
> >
> >
> >
> >
> > and then in any other form, i use this to access the datebase
> >
> > Set rs =3D New ADODB.Recordset
> > rs.ActiveConnection =3D connMySQL
> > rs.Open sqlstr, connMySQL, adOpenStatic, adLockOptimistic
> >
> >
> >
> > so, for example, if i start my application, and leave it running for a
> > while ( doing nothing ) and then try use a funtion to access the
> > database, it does not work. I presume this is because the connection
> > has timed out?
> >
> > is there a better way of handling this? i dont think its wize just in
> > increase the timeout on the database?
> >
> >
> >
> > thanks
> >
> > Mark
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> > --
> > MySQL Windows Mailing List
> > For list archives: http://lists.mysql.com/win32
> > To unsubscribe:
> http://lists.mysql.com/win32?unsub=3Ddanieldaveiga@gmail.com
> >
> >
>=20
>=20
> --
> Daniel da Veiga
> Computer Operator - RS - Brazil
>=20
> --
> MySQL Windows Mailing List
> For list archives: http://lists.mysql.com/win32
> To unsubscribe: http://lists.mysql.com/win32?unsub=3Dbullijr@innovatim=
..com
>=20
>=20
>=20
>=20


--=20
Daniel da Veiga
Computer Operator - RS - Brazil

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

RE: connection issue

am 26.07.2005 16:23:05 von ml.mysql

> so, for example, if i start my application, and leave
> it running for a while ( doing nothing ) and then try
> use a funtion to access the database, it does not
> work. I presume this is because the connection has
> timed out?
>=20
> is there a better way of handling this? i dont think
> its wize just in increase the timeout on the database?


Maybe add a timer object that makes a very simple query every minute or
so. Like a SHOW PROCESSES or something.

-Kevin

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

Re: connection issue

am 26.07.2005 16:31:17 von Mike Hillyer

I personally just keep the connection open for as long as I am using it, then
close it when I am done. It opens and closes so quickly I have never had a
problem with just opening one on demand.

You could of course add a error handler and if you get an error from MySQL then
your error handler can re-open the connection and try again (with a count of
errors in a row so you can eventually give up if the connection cannot be
established).

Mike


Mark Mchugh wrote:
> Hi,
> I am using the following connection, which i use when
> my application starts
>
>
> Set connMySQL = New ADODB.Connection
> connMySQL.ConnectionString = "DRIVER={mySQL ODBC
> 3.51 Driver};" _
> & "SERVER=192.168.0.55;" _
> & "DATABASE=test;" _
> & "UID=root;" _
> & "PWD=;" _
> & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
>
> connMySQL.CursorLocation = adUseClient
>
> connMySQL.Open
>
>
>
>
> and then in any other form, i use this to access the
> datebase
>
> Set rs = New ADODB.Recordset
> rs.ActiveConnection = connMySQL
> rs.Open sqlstr, connMySQL, adOpenStatic,
> adLockOptimistic
>
>
>
> so, for example, if i start my application, and leave
> it running for a while ( doing nothing ) and then try
> use a funtion to access the database, it does not
> work. I presume this is because the connection has
> timed out?
>
> is there a better way of handling this? i dont think
> its wize just in increase the timeout on the database?
>
>
>
> thanks
>
> Mark
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

--
Mike Hillyer, Technical Writer
Lethbridge, Alberta, Canada
MySQL AB, www.mysql.com


"The Open Source movement has become a major force across the software industry,
and MySQL is the world's most popular open source database."
--Fortune Magazine

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org