Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

jdbc with microsoft SQl Server 2008

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wrinting a simple java code that communicate with microsoft SQL Server 2008

and after this set classpath of sqljdbc4.jar
and after this i comile the program i got following error
C:\Documents and Settings\r6876046\Desktop>javac package does not exist
1 error

here is my source code

import java.sql.*;
class Test
public static void main(String[] args) throws Exception
// Register the driver
// Establish connection with the Database
Connection con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433:","sa","jeffrey");
//cfreate a sql statement
Statement stmt=con.createStatement();
//Execute the stmt
ResultSet rs=stmt.executeQuery("select * from studentinfo");
//all row of student table are in rs Now retrive column data from rs and display
// close the connection

Please help me about this and where i need to change and how i achive the goal please guide me properly i am waiting for Your Response

thanks In Advance

Posts: 4107
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

to load and register the driver class with the DriverManager.
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic