SQL Server DBI insert silently fails

Discussion in 'Ruby' started by Leslie Viljoen, Jul 28, 2006.

  1. Hi all

    I am having problems when trying to insert records using dbi-0.1.0 on
    Windows XP.
    I am using the ADO driver to connect to SQL Server, like so:

    connectString = "DBI:ADO:provider=SQLOLEDB.1;Data Source=10.0.0.1;User
    id=xxxx; password=xxxx;Initial Catalog=DevDB"

    I get rows == nil when I run this:

    qry = "insert into G2.dbo.Device (IPadress, SerialNumber, VehicleID, " +
    "SerialNumberB, Tag1, Tag2, FwVersion, HwVersion) values
    (?, ?, ?, ?, ?, ?, ?, ?)"
    rows = @database.do(qry, device[:ip], device[:serial],
    device[:serial], device[:serial], 0, 0, 0, 0)
    print "rows done: "
    p rows


    ..and the record is not inserted. I get no other error response.


    The strange thing is that select queries function perfectly, giving me
    valid data back.
    Any ideas?


    Les
     
    Leslie Viljoen, Jul 28, 2006
    #1
    1. Advertising

  2. Leslie Viljoen wrote:
    > Hi all
    >=20
    > I am having problems when trying to insert records using dbi-0.1.0 on
    > Windows XP.
    > I am using the ADO driver to connect to SQL Server, like so:
    >=20
    > connectString =3D "DBI:ADO:provider=3DSQLOLEDB.1;Data =

    Source=3D10.0.0.1;User
    > id=3Dxxxx; password=3Dxxxx;Initial Catalog=3DDevDB"
    >=20
    > I get rows =3D=3D nil when I run this:
    >=20
    > qry =3D "insert into G2.dbo.Device (IPadress, SerialNumber, VehicleID, =

    " +
    > "SerialNumberB, Tag1, Tag2, FwVersion, HwVersion) values
    > (?, ?, ?, ?, ?, ?, ?, ?)"
    > rows =3D @database.do(qry, device[:ip], device[:serial],
    > device[:serial], device[:serial], 0, 0, 0, 0)
    > print "rows done: "
    > p rows
    >=20
    >=20
    > ..and the record is not inserted. I get no other error response.
    >=20
    >=20
    > The strange thing is that select queries function perfectly, giving me
    > valid data back.
    > Any ideas?
    >=20
    >=20
    > Les
    >=20


    Did you commit after inserting?

    - Dan


    This communication is the property of Qwest and may contain confidential =
    or
    privileged information. Unauthorized use of this communication is =
    strictly=20
    prohibited and may be unlawful. If you have received this communication =

    in error, please immediately notify the sender by reply e-mail and =
    destroy=20
    all copies of the communication and any attachments.
     
    Daniel Berger, Jul 28, 2006
    #2
    1. Advertising

  3. On 7/28/06, Daniel Berger <> wrote:
    > Leslie Viljoen wrote:
    > > Hi all
    > >
    > > I am having problems when trying to insert records using dbi-0.1.0 on
    > > Windows XP.
    > > I am using the ADO driver to connect to SQL Server, like so:
    > >
    > > connectString = "DBI:ADO:provider=SQLOLEDB.1;Data Source=10.0.0.1;User
    > > id=xxxx; password=xxxx;Initial Catalog=DevDB"
    > >
    > > I get rows == nil when I run this:
    > >
    > > qry = "insert into G2.dbo.Device (IPadress, SerialNumber, VehicleID, " +
    > > "SerialNumberB, Tag1, Tag2, FwVersion, HwVersion) values
    > > (?, ?, ?, ?, ?, ?, ?, ?)"
    > > rows = @database.do(qry, device[:ip], device[:serial],
    > > device[:serial], device[:serial], 0, 0, 0, 0)
    > > print "rows done: "
    > > p rows
    > >
    > >
    > > ..and the record is not inserted. I get no other error response.
    > >
    > >
    > > The strange thing is that select queries function perfectly, giving me
    > > valid data back.
    > > Any ideas?
    > >
    > >
    > > Les
    > >

    >
    > Did you commit after inserting?


    You were right! I didn't realise that some databases don't commit automatically!
    I'm really grateful for your help.

    Les
     
    Leslie Viljoen, Jul 28, 2006
    #3
    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. Ronald Fischer

    JSP silently fails to compile

    Ronald Fischer, Oct 13, 2003, in forum: Java
    Replies:
    9
    Views:
    535
    John C. Bollinger
    Oct 21, 2003
  2. cannontrodder
    Replies:
    1
    Views:
    736
    cannontrodder
    Jul 25, 2006
  3. WuBin
    Replies:
    2
    Views:
    792
    Jeff Dillon
    Aug 21, 2008
  4. Ben Phillips

    SwingWorker.execute() silently fails?

    Ben Phillips, Oct 8, 2008, in forum: Java
    Replies:
    3
    Views:
    612
    Ben Phillips
    Oct 9, 2008
  5. Jon Hendry
    Replies:
    5
    Views:
    240
    Jon Hendry
    Mar 7, 2007
Loading...

Share This Page