SQL connecting

Discussion in 'Python' started by Scripter47, Jan 29, 2007.

  1. Scripter47

    Scripter47 Guest

    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)
    
    --
    _________ .__ __ ______________
    / _____/ ___________|__|______/ |_ ___________ / | \______ \
    \_____ \_/ ___\_ __ \ \____ \ __\/ __ \_ __ \/ | |_ / /
    / \ \___| | \/ | |_> > | \ ___/| | \/ ^ / / /
    /_______ /\___ >__| |__| __/|__| \___ >__| \____ | /____/
    \/ \/ |__| \/ |__|
     
    Scripter47, Jan 29, 2007
    #1
    1. Advertising

  2. Scripter47

    John Nagle Guest

    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
     
    John Nagle, Jan 29, 2007
    #2
    1. Advertising

  3. Scripter47

    Scripter47 Guest

    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 :)
     
    Scripter47, Jan 29, 2007
    #3
  4. On Mon, 29 Jan 2007 19:45:47 GMT, John Nagle <>
    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://wlfraed.home.netcom.com/
    (Bestiaria Support Staff: )
    HTTP://www.bestiaria.com/
     
    Dennis Lee Bieber, Jan 30, 2007
    #4
  5. Scripter47

    Scripter47 Guest

    Dennis Lee Bieber skrev:
    > On Mon, 29 Jan 2007 19:45:47 GMT, John Nagle <>
    > 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
     
    Scripter47, Jan 30, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Bertrand - MVP

    Connecting to SQL Server DB

    Aaron Bertrand - MVP, Dec 3, 2003, in forum: ASP .Net
    Replies:
    14
    Views:
    773
    len nelson
    Oct 8, 2004
  2. Robert
    Replies:
    4
    Views:
    2,246
    George Ter-Saakov
    Feb 9, 2004
  3. Thomas Scheiderich

    Sql Ole not connecting

    Thomas Scheiderich, Apr 11, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    498
    Mary Chipman
    Apr 12, 2004
  4. =?Utf-8?B?TmVpbCBQYWRkb2Nr?=

    Connecting to SQL 2000 database with SQL 2005 tools installed

    =?Utf-8?B?TmVpbCBQYWRkb2Nr?=, May 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    420
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    May 2, 2007
  5. ecoolone
    Replies:
    0
    Views:
    797
    ecoolone
    Jan 3, 2008
Loading...

Share This Page