SQL connecting

S

Scripter47

Hey

It got a problem with python to connect to my SQL DBs, that's installed
on my apache server. how do i connect to sql? Gettting data? Insert into it?

it is a localserver with php if that means something

here is a *REALLY* dirty solution that a have used:
Code:
from urllib import *
# sql query
s = 'INSERT INTO `test` (`test`) VALUES ("1");'

# encode and insert into db
params = urlencode({'sql': sql})
urlopen("http://localhost/in/sql.php?%s" % params)

--
_________ .__ __ ______________
/ _____/ ___________|__|______/ |_ ___________ / | \______ \
\_____ \_/ ___\_ __ \ \____ \ __\/ __ \_ __ \/ | |_ / /
/ \ \___| | \/ | |_> > | \ ___/| | \/ ^ / / /
/_______ /\___ >__| |__| __/|__| \___ >__| \____ | /____/
\/ \/ |__| \/ |__|
 
J

John Nagle

Scripter47 said:
Hey

It got a problem with python to connect to my SQL DBs, that's installed
on my apache server. how do i connect to sql? Gettting data? Insert into
it?

You need a third-party open source package called "MySQLdb".

John Nagle
 
S

Scripter47

John Nagle skrev:
You need a third-party open source package called "MySQLdb".

John Nagle
Yeah look great but im using python 2.5, and it only support 2.3-2.4 :(,
but thanks :)

Any better solutions :)
 
D

Dennis Lee Bieber

You need a third-party open source package called "MySQLdb".
Call me a nit, but did the original poster mean "MySQL" databases,
or only that he uses SQL to access "my databases". The spelling is
unclear as to what DBMS engine is actually being used. If it is /not/
MySQL, then MySQLdb is futile.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
S

Scripter47

Dennis Lee Bieber skrev:
Call me a nit, but did the original poster mean "MySQL" databases,
or only that he uses SQL to access "my databases". The spelling is
unclear as to what DBMS engine is actually being used. If it is /not/
MySQL, then MySQLdb is futile.
Sry i didn't said it. it is a MySQL DB on a apache server
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top