File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes MS SQL driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MS SQL driver" Watch "MS SQL driver" New topic
Author

MS SQL driver

ray bond
Ranch Hand

Joined: Oct 11, 2000
Posts: 111
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).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
This is the wrong format:
Connection con = DriverManager.getConnection("jdbc.odbc.bookmarkdb","","");
What you want is:
Connection con = DriverManager.getConnection("jdbcdbc:bookmarkdb","","");

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
ray bond
Ranch Hand

Joined: Oct 11, 2000
Posts: 111
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MS SQL driver