• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Basic SQL Server JDBC problem

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I connect to a SQL Server database called "Calendar" with a string like this:
"jdbc:microsoft:sqlserver://DellPC:1433;"+
"Database=Calendar;User=test;Password=test";
(Note I specify the database here -- Calendar)
Then, after making sure the permissions are correct (can log into the calendar database from Query Analyzer and do a select on the same table the code below tries to do), I try to do a select on the users table in this database like this:
SQL = "SELECT COUNT(*) as Count FROM " +
"users where use_loginID = " + login + " AND " + "use_password = " + password +";";
(login and password values came from an HTML form)
However, when I executeQuery() I get the error:
"Invlid Object name users".
Any ideas what's wrong here?
Thanks in advance.
-- Mike
 
I was her plaything! And so was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic