Forums Register Login

Class.forName()

+Pie Number of slices to send: Send
import java.sql.*;
public class first{
public static void main(String[] args){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc.odbc.MyDataSource","sa","");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("Select * from authors");
rs.beforeFirst();
while(rs.next()){
String id=rs.getString("au_id");
System.out.print(id);
}
rs.close();
}

catch(Exception e){
System.out.println(e);
}

}
}

Helo frnd In the above code it is throwing a exception that not sutable driver why ?

with regard

Arun
+Pie Number of slices to send: Send
Moving to the JDBC forum.
+Pie Number of slices to send: Send
Thers is nothing wrong in Class.forName(). Problem is at the time of connection.

At the time of connection, you need to provide three thing.. jdbc_url, username and password.



Your jdbc url is not correct. It should be "jdbc:odbc:MyDataSource" instead of "jdbc.odbc.MyDataSource".


Naseem
[ July 13, 2006: Message edited by: Naseem Khan ]
Forget Steve. Look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1009 times.
Similar Threads
how to create summary and detail table
I can't connect to DB
HOW TO Upload files to db (postgres) using java/jdbc
how to retrive the data of the last row in the table ?
oracle 8i jdbc problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:10:28.