Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc problem problem problem

 
priya love
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic