By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

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

P: 19
I am get this error

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


my code for connection is
Expand|Select|Wrap|Line Numbers
  1. {   
  2. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  3. con=DriverManager.getConnection("jdbc:odbc:MyDataSource1");
  4. ps=con.prepareStatement("Select * from Reservation where TravelDate=? and FlightNo=?");
  5. ps.setString(1,t1.getText());
  6. ps.setString(2,t2.getText());
  7. rs=ps.executeQuery();
  8. rs.next();
  9. t3.setText(Integer.toString(rs.getInt(3)));
  10. t4.setText(Integer.toString(rs.getInt(4)));
  11. t5.setText(Integer.toString(rs.getInt(5)));
  12. con.close();
  13. }
  14.  
Mar 30 '07 #1
Share this Question
Share on Google+
12 Replies


10K+
P: 13,264
hi,
iam get this error

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

my code for connection is
Expand|Select|Wrap|Line Numbers
  1. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  2. con=DriverManager.getConnection("jdbc:odbc:MyDataSource1");
  3. ps=con.prepareStatement("Select * from Reservation where TravelDate=? and FlightNo=?");
  4. ps.setString(1,t1.getText());
  5. ps.setString(2,t2.getText());
  6. rs=ps.executeQuery();
  7. rs.next();
  8. t3.setText(Integer.toString(rs.getInt(3)));
  9. t4.setText(Integer.toString(rs.getInt(4)));
  10. t5.setText(Integer.toString(rs.getInt(5)));
  11. con.close();
  12. }
  13.  
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?
Mar 30 '07 #2

P: 19
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
Mar 30 '07 #3

10K+
P: 13,264
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
Mar 30 '07 #4

P: 19
Create a user DSN
still getting same error
Mar 30 '07 #5

10K+
P: 13,264
still getting same error
Did you complete all the required steps for creating the datasource?
Tell us how you did it.
Mar 30 '07 #6

P: 19
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
Mar 30 '07 #7

10K+
P: 13,264
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)
Mar 30 '07 #8

P: 19
After add, select

Microsoft Acces Driver (*.mdb)
created but getting the same error
Mar 30 '07 #9

P: 19
created but getting the same error
IS there any 1 to help me
Apr 1 '07 #10

10K+
P: 13,264
created but getting the same error
How did you create the datasource after selecting *mdb?
Apr 2 '07 #11

P: 1
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
Apr 13 '10 #12

P: 1
what is the solution of this problem???"java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Dec 28 '11 #13

Post your reply

Sign in to post your reply or Sign up for a free account.

Browse more Java Questions on Bytes