Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SQL connecting

Reply
Thread Tools

SQL connecting

 
 
Scripter47
Guest
Posts: n/a
 
      01-29-2007
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)
--
_________ .__ __ ______________
/ _____/ ___________|__|______/ |_ ___________ / | \______ \
\_____ \_/ ___\_ __ \ \____ \ __\/ __ \_ __ \/ | |_ / /
/ \ \___| | \/ | |_> > | \ ___/| | \/ ^ / / /
/_______ /\___ >__| |__| __/|__| \___ >__| \____ | /____/
\/ \/ |__| \/ |__|


 
Reply With Quote
 
 
 
 
John Nagle
Guest
Posts: n/a
 
      01-29-2007
Scripter47 wrote:
> 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
 
Reply With Quote
 
 
 
 
Scripter47
Guest
Posts: n/a
 
      01-29-2007
John Nagle skrev:
> Scripter47 wrote:
>> 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

Yeah look great but im using python 2.5, and it only support 2.3-2.4 ,
but thanks

Any better solutions

 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      01-30-2007
On Mon, 29 Jan 2007 19:45:47 GMT, John Nagle <(E-Mail Removed)>
declaimed the following in comp.lang.python:

> Scripter47 wrote:
> > 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".
>

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
http://www.velocityreviews.com/forums/(E-Mail Removed) (E-Mail Removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (E-Mail Removed))
HTTP://www.bestiaria.com/
 
Reply With Quote
 
Scripter47
Guest
Posts: n/a
 
      01-30-2007
Dennis Lee Bieber skrev:
> On Mon, 29 Jan 2007 19:45:47 GMT, John Nagle <(E-Mail Removed)>
> declaimed the following in comp.lang.python:
>
>> Scripter47 wrote:
>>> 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".
>>

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help. Getting a An error has occurred while establishing a connectionto the server. When connecting to SQL Server 2005, this failure may be causedby the fact that under the default settings SQL Server does not allow remote aboutjav.com@gmail.com ASP .Net 0 05-03-2008 12:43 PM
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
Connecting to SQL 2000 database with SQL 2005 tools installed =?Utf-8?B?TmVpbCBQYWRkb2Nr?= ASP .Net 1 05-02-2007 03:18 PM
Connecting to SQL Server DB Aaron Bertrand - MVP ASP .Net 14 10-08-2004 02:40 AM
Connecting to SQL Server from Web pages Robert ASP .Net 4 02-09-2004 04:30 PM



Advertisments