Results 1 to 7 of 7

Thread: java to MS SQL

  1. #1

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112

    java to MS SQL

    i'm new to this thing. sorry for bothers but i want to know what did i miss? i have this code throwing an exception of com.microsoft.jdbc.sqlserver.SQLServerDriver
    PHP Code:
    import java.sql.*;

    public class 
    JdbcExample3{
        public static 
    void main(String args[]){
            
    Connection conn=null;
            try{
                Class.
    forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                
    conn=DriverManager.getConnection(
                    
    "jdbc:microsoft:sqlserver:///northwind");
                if(!
    conn.isClosed())
                    
    System.out.println("sucessfully connected to sql server...");
            }
            catch(
    Exception e){
                
    System.err.println("Exception: "+e.getMessage());
            }
            finally{
                try{
                    if(
    conn!=nullconn.close();
                }
                catch(
    SQLException e){}
            }
        }

    i installed the j2sdk1.4.0, microsoft sql server 2000 for jdbc driver and the ms sql 2000.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    What's the exact error?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    yo, corned... this is the output, an exception...

    Exception: com.microsoft.jdbc.sqlserver.SQLServerDriver

    thanx for the reply...

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Can you give the output of e.printStackTrace() ?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    Code:
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
    	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:130)
    	at JdbcExample3.main(JdbcExample3.java:7)

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    The JDBC driver is not installed properly and not found by the Java runtime.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    i'll just try to download the driver again or maybe find another one... thanx corned. just have to search more. thanx so much...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width