?
Solved

How to link SQL SERVER with JAVA?

Posted on 2003-03-11
6
Medium Priority
?
190 Views
Last Modified: 2012-06-22
I'm doing a cafe management system.I would like to know how to like SQL Server with Java.Hope to hear from you soon.I need it urgently.I would also like to know where i can see some Java typical systems as the one i'm doing.Please help me.Thanks
0
Comment
Question by:Alisha23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
chuckie79 earned 1000 total points
ID: 8112535
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8114967
you can use generic ODBC connection:

import java.sql.*;
import java.util.*;

public class CounterData {
  private Connection con = null;

  public CounterData() { }
 
  public CounterData(String DatabaseName) {
    Connect(DatabaseName);
  }

  public boolean Connect(String DatabaseName) {
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    } catch (Exception e) {
      System.out.println("Failed to load JDBC/ODBC driver.");
      return false;
    }
    try {
      con = DriverManager.getConnection("jdbc:odbc:"+DatabaseName);
    } catch (Exception e) {
      System.out.println(e);
      return false;
    }
    return isConnected();
  }
  public void Disconnect() {
    try {
      if (con != null) con.close();
    } catch (SQLException e) {}
  }
}

wbr, mo.
0
 

Expert Comment

by:prasannaa
ID: 8118577
If you r using SQL Server 2000
Instead of using JDBC ODBC Bridge u can download the Microsoft SQL Server 2000 Driver for JDBC from microsoft web site and you can use the driver
And u can use the help

Cheers
prasannaa
0
 

Expert Comment

by:CleanupPing
ID: 9474555
Alisha23:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question