• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

need help with connect to driver  RSS feed

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i run "java Auth", it shows data source name
not found.so how can i connect to jdbc driver?
Thanks.
------------------------------------------------
import java.sql.*;
public class Auth
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (java.lang.ClassNotFoundException e)
{
System.out.println(e.getMessage());
}
try
{
Connection con =
DriverManager.getConnection("jdbc dbc:bookbase");
Statement stmt = con.createStatement();
stmt.executeUpdate("create table authTab (" +
"auth char(10), " +
"tel char(12) CONSTRAINT authIndex PRIMARY KEY)");
stmt.close();
con.close();
}
catch (SQLException ex)
{
System.out.println("SQLException: "+ex.getMessage());
}
}
}
 
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,
Excuse me if you are already aware of this, but you need to set up an ODBC data source.
[I am assuming -- from your post -- that your platform is Windows and you are using some kind of Microsoft database -- like MS Access.]
If this is correct, then you set up the data source via "Control Panel".
On my Windows XP machine, when I open the "Control Panel" window, it contains an icon entitled "Administrative Tools". When I double-click on that icon, I get another window that contains an icon entitled "Data Sources (ODBC)". Double-clicking on that icon starts up a "wizard" that guides you through setting up a data source.
Hope this helps.
Good Luck,
Avi.
 
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi:
my computer is Win 2000. when i clik Microsoft
odbc administrator, i did not see any "wizard"
my odbc just has "User DNS","System DNS",
"File DNS","Driver",....something like this.
so how can i set up? Thanks
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric,
I think you need to set up a "User DNS". It's been a long time since I did it, so I don't remember exactly, but I do remember I managed to figure it out by myself (and I'm too lazy to make the effort to hold your hand and guide you through it -- sorry). Try reading the "help", or doing an Internet search for "setting up ODBC datasource on Windows 2000 as User DSN" (or something like that :-)
Good Luck,
Avi.
P.S. I _know_ you can do it, Eric!
 
eric lee
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Avi Abrami , i will try that
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Maybe i can help you if you are still stucked.
1. Go to system dns.
2. choose add.
3. in the data source name , write the name you use for your db when u connect it.
4. choose your db from select.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!