473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
12 31959
r035198x
13,262 8TB
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
bhanu08
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
r035198x
13,262 8TB
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
bhanu08
19
Create a user DSN
still getting same error
Mar 30 '07 #5
r035198x
13,262 8TB
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
bhanu08
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
r035198x
13,262 8TB
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
bhanu08
19
After add, select

Microsoft Acces Driver (*.mdb)
created but getting the same error
Mar 30 '07 #9
bhanu08
19
created but getting the same error
IS there any 1 to help me
Apr 1 '07 #10
r035198x
13,262 8TB
created but getting the same error
How did you create the datasource after selecting *mdb?
Apr 2 '07 #11
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
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

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

Similar topics

1
by: Tim Groulx | last post by:
Hello All, I am getting the following error when attemping to open a table in SQL2kSP3a. ________________________________________ SQL Server Enterprise Manager Database Server: Microsoft SQL...
10
by: FreeOperator | last post by:
Dear all, On Win2000 server with SP3, I am trying to access a SQL Server 7.0 database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO 2.7. In SQL Server Enterprise Manager, there...
8
by: Dakkar | last post by:
I wrote a program with c# for connecting mysql and taking data from it but when someone without me try to execute the program they are taking this error ERROR Data source name not found and...
4
by: cipher | last post by:
Hello, I'm creating a webservice that needs to query an Access database (mdb). Here's my code: OdbcConnection *pConnection = new OdbcConnection("Driver={Microsoft Access Driver...
0
by: jwtulp | last post by:
Hello all, I receive the following error when updating MSAccess2003 Memo fields using an ODBC connection in ASP.Net 1.1 when the length of the text to be updated exceeds 255 characters....
0
by: bazzer | last post by:
hey, i am using visual basic.net 2003 and have an ASP.NET webform application thats accessing a microsoft access 2003 database. i kept getting the following error when i tried to run it: ERROR ...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
2
by: MrByte | last post by:
Hi Folks, I'm having a strange situation here between 2 Linked MS SQL 2K servers. One of the servers died recently and I rebuilt it. All seems to be working fine, except that when I create...
1
by: harsha1302 | last post by:
Hi all i am trying to connect my application written in jsp to the database and i am receiving this exception java.sql.SQLException: Data source name not found and no default driver specified...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.