• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

MS SQL driver

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello there , I have two systems server(winnt) and desktop(win98), MS SQL database is on server and it has "Bookmark " database , I have created jdbc application to get rows from that database , on my desktop system I have configured ODBC datasource
and connected "bookmarkdb" data source with "Bookmark" database on server and also tested connection , it is OK ,
but when I run my jdbc application on my desktop system , on console window it just print out "jdbc.odbc.JdbcOdbcDriver" and nothing else , code of application is below , please can somebody tell me what should I do so I can get this application working and it prints qurery results , is there any thing wrong with driver ,I have tried same process with MS access database as well , but still on console it prints "jdbc.odbc.JdbcOdbcDriver" , do I have to use other driver for MS SQL , if so then which driver, thank you
import java.sql.*;
import java.io.*;
public class db
{

public static void main(String args[])
{


String username;
String password;
String name;
String email;
try{
Class.forName("jdbc.odbc.JdbcOdbcDriver").newInstance();

Connection con = DriverManager.getConnection("jdbc.odbc.bookmarkdb","","");
System.out.println("got connection");
Statement stmt = con.createStatement();

ResultSet rst = stmt.executeQuery("SELECT * FROM information");
while(rst.next())
{
username = rst.getString(1);
System.out.println(username);
password = rst.getString(2);
System.out.println(password);
name = rst.getString(3);
System.out.println(name);
email = rst.getString(4);
System.out.println(email);
}
con.close();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
[This message has been edited by ray bond (edited December 21, 2000).]
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the wrong format:
Connection con = DriverManager.getConnection("jdbc.odbc.bookmarkdb","","");
What you want is:
Connection con = DriverManager.getConnection("jdbc:odbc:bookmarkdb","","");
 
ray bond
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello thomas ,
thank you for your reply , I modified my mistake , but
still when I run application on dos prompt it prints out
"jdbc.odbc.JdbcOdbcDriver" and nothing else , I tried same application with MS access on my local system and also configured
DSN for that , but still it prints out "jdbc.odbc.JdbcOdbcDriver", what should I do to print out result set on command prompt.
thank you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic