• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

connet to sql server and run query

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what i want to do but i dont know how possible it is:
I want to write a program to connect to an sql server database over a lan and execute a select query and have the results returned to me and displayed in a table in the java program. Any ideas? thanks
james
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite possible, but offtopic for this forum. Moving this post to "JDBC", the forum that deals with the Java DataBase Connectivity API, which lets you talk to databases.
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use url connection string:
jdbc:microsoft:sqlserver://yourServerName:1433;user=yourUser;password=yourPwd
found atHOWTO: Connect to a SQL Server 2000 Named Instance with JDBC
Good Luck
 
Jason Steele
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: Port may be different!
 
James Ajewole
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i connect to an sql server 7 server from a java program. and what do i need to configure on the server?
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to purchase a SQL Server 7 driver (MS does not provide one, and the 2000 driver does not work) or use the ODBC bridge driver (sun.jdbc.odbc.JdbcOdbcDriver) with URL jdbc dbc:<odbc name>. Note that with ODBC you need to make an ODBC entry on the machine for the database.
Also note that the odbc bridge driver performs very poorly, and gives unexpected results. It's not meant for production use.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic