This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes  jdbc problem problem problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark " jdbc problem problem problem" Watch " jdbc problem problem problem" New topic
Author

jdbc problem problem problem

priya love
Greenhorn

Joined: Aug 30, 2003
Posts: 1
when I connect the jdbcodbc independently then its doing the business but when doing in swings it is giving driver not found though the DSN is Same
the code:
import java.sql.*;
class ot {
public static void main(String[] args)
{
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception ClassNotFoundException)
{
System.out.println("Class Not Found Exception");
}
System.out.println("Trying to connect...");
try
{
Connection conn=DriverManager.getConnection("jdbc dbc:test","","");/test the dsn
Statement stmt=conn.createStatement();
ResultSet result;
System.out.println("Connected.");
String sql1 = "insert into empr(emp,add,zip) values ("+ 5 +","+ 7 +","+ 9 +")";
stmt.executeUpdate(sql1);
conn.close();

}
catch(SQLException sq)
{
System.out.println("SQL exception: " + sq.getMessage());
}
}
}
can anyone help me

Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227

when I connect the jdbcodbc independently then its doing the business but when doing in swings it is giving driver not found though the DSN is Same

Huh? Please rephrase.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
priya love,
Welcome to JavaRanch!
If that ain't your real name, please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
Concerning your question, my first guess is that you do not have the JDBC driver locatable in your CLASSPATH.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc problem problem problem
 
Similar Threads
jdbc connection and query execution
connectivity between java and ms access
problem connecting with the database
JdbcOdbc Connection
URL error (DSN not found)