java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found a

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhanu08
    New Member
    • Jan 2007
    • 19

    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found a

    I am get this error

    java.sql.SQLExc eption: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


    my code for connection is
    Code:
    {   
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:MyDataSource1");
    ps=con.prepareStatement("Select * from Reservation where TravelDate=? and FlightNo=?");
    ps.setString(1,t1.getText());
    ps.setString(2,t2.getText());
    rs=ps.executeQuery();
    rs.next();
    t3.setText(Integer.toString(rs.getInt(3)));
    t4.setText(Integer.toString(rs.getInt(4)));
    t5.setText(Integer.toString(rs.getInt(5)));
    con.close();
    }
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by bhanu08
    hi,
    iam get this error

    java.sql.SQLExc eption: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    my code for connection is
    Code:
    { 
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:MyDataSource1");
    ps=con.prepareStatement("Select * from Reservation where TravelDate=? and FlightNo=?");
    ps.setString(1,t1.getText());
    ps.setString(2,t2.getText());
    rs=ps.executeQuery();
    rs.next();
    t3.setText(Integer.toString(rs.getInt(3)));
    t4.setText(Integer.toString(rs.getInt(4)));
    t5.setText(Integer.toString(rs.getInt(5)));
    con.close();
    }
    Just like the error said. You did not create the datasource. What paltform are you using and which database are you trying to connect to?

    Comment

    • bhanu08
      New Member
      • Jan 2007
      • 19

      #3
      Originally posted by r035198x
      Just like the error said. You did not create the datasource. What paltform are you using and which database are you trying to connect to?
      iam working on windows XP and iam using MS acess
      I tried to creat a DSN but having a doubt weather i have to creat USER DSNor SYSTEM DSN

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by bhanu08
        iam working on windows XP and iam using MS acess
        I tried to creat a DSN but having a doubt weather i have to creat USER DSNor SYSTEM DSN
        Create a user DSN

        Comment

        • bhanu08
          New Member
          • Jan 2007
          • 19

          #5
          Originally posted by r035198x
          Create a user DSN
          still getting same error

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by bhanu08
            still getting same error
            Did you complete all the required steps for creating the datasource?
            Tell us how you did it.

            Comment

            • bhanu08
              New Member
              • Jan 2007
              • 19

              #7
              i clicked ODBC Data Source Adminstrator
              then
              clicked User DSN
              then
              clicked Add
              then selected
              Driver Do Microsoft Access
              then
              clicked select and then browsed the .mdb file and clicked ok
              this is the thing i did

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by bhanu08
                i clicked ODBC Data Source Adminstrator
                then
                clicked User DSN
                then
                clicked Add
                then selected
                Driver Do Microsoft Access
                then
                clicked select and then browsed the .mdb file and clicked ok
                this is the thing i did
                After add, select

                Microsoft Acces Driver (*.mdb)

                Comment

                • bhanu08
                  New Member
                  • Jan 2007
                  • 19

                  #9
                  Originally posted by r035198x
                  After add, select

                  Microsoft Acces Driver (*.mdb)
                  created but getting the same error

                  Comment

                  • bhanu08
                    New Member
                    • Jan 2007
                    • 19

                    #10
                    Originally posted by bhanu08
                    created but getting the same error
                    IS there any 1 to help me

                    Comment

                    • r035198x
                      MVP
                      • Sep 2006
                      • 13225

                      #11
                      Originally posted by bhanu08
                      created but getting the same error
                      How did you create the datasource after selecting *mdb?

                      Comment

                      • chisepo
                        New Member
                        • Apr 2010
                        • 1

                        #12
                        When selecting the database name to put in the data source, make sure you don't put the access extention '.mdb' as this will make it lose the data sorce. the data source name should only have the database name with no extentiojn and the spelling should be 100% the same. Goog day man

                        Comment

                        • Avijit Kar
                          New Member
                          • Dec 2011
                          • 1

                          #13
                          what is the solution of this problem???"java .sql.SQLExcepti on: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

                          Comment

                          Working...