943,861 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 383
  • Java RSS
Jun 27th, 2009
-1

tough to get me

Expand Post »
consider the following snippet:
import java.sql.*;
public class test
{
public static void main(String args[])
{
try
{
Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");
Connection cn;
cn=DriverManager.getConnection("jdbc:odbc","username","password");
Statement st=cn.createStatement();
st.executeQuery("select * from emp");
System.out.println("Succeed");
}
catch(Exception e)
{
System.out.println("Faild");
}
finall()
{
system.out.println("Always");
}
}
}
what will be the result
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
cutedipti is offline Offline
45 posts
since Sep 2008
Jun 27th, 2009
-1

Re: tough to get me

Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Jun 27th, 2009
0

Re: tough to get me

Click to Expand / Collapse  Quote originally posted by peter_budo ...
Error while compiling, as there is nothing like Class.forNameI"sun.jdbc.odbc.JdbcOdbcDriverManager");, finall(); system.out.println("Always");



It's .........
Class.forName("sun.jdbc.odbc.JdbcOdbcDriverManager");

& other is......
finally
{
System.out.println("Always");
}
Click to Expand / Collapse  Quote originally posted by cutedipti ...
Actualy i am about :
JDBC-ODBC bridge driver
OR JDBC-Net pure java driver
Reputation Points: 10
Solved Threads: 0
Light Poster
cutedipti is offline Offline
45 posts
since Sep 2008
Jun 27th, 2009
0

Re: tough to get me

Wrap up source code with bb code tags.
>what will be the result
Have you compiled this code?
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008
Jun 27th, 2009
-1

Re: tough to get me

Result can be anything Succeed and Always if there been no issue, it can be Faild if table doesn't exist, or it can be number of errors because of various reasons.
So you better post what errors you getting.

PS: Gravely mistake in your code, you never closed Connection after you finished with DB
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: About JDBC driver
Next Thread in Java Forum Timeline: Oracle 9i and jdbc1.4 discrepancy





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC