Java J2EE (14736)
J2ME (151)
Java Related AllOther (507) dear friends I have made connection with SQLSERVER where the following code is compiling properly but giving error at the runtime . I think error in this line where i am sending the value through string Connection connection = DriverManager.getConnection ( "jdbc:microsoft:sqlserver://localhost:1433","sa",""); import java.sql.*; //import mssqlserver.*; public class TestSQLCON { public TestSQLCON() throws Exception { // Get connection DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver()); System.out.println(); System.out.println("Successfully connected one"); System.out.println(); Connection connection = DriverManager.getConnection ( "jdbc:microsoft:sqlserver://localhost:1433","sa",""); if (connection != null) { System.out.println(); System.out.println("Successfully connected"); System.out.println(); // Meta data DatabaseMetaData meta = connection.getMetaData(); System.out.println("\nDriver Information"); System.out.println("Driver Name: " + meta.getDriverName()); System.out.println("Driver Version: " + meta.getDriverVersion()); System.out.println("\nDatabase Information "); System.out.println("Database Name: " + meta.getDatabaseProductName()); System.out.println("Database Version: "+ meta.getDatabaseProductVersion()); } } public static void main (String args[]) throws Exception { TestSQLCON test = new TestSQLCON(); } } so please help me
2 5357when we applied start()method on a thread ,how does it know that to execute run()method on that object?
HCL,
2 6315public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod
TCS,
4 7631if two references are having same hash codes,is that means those are refering to same object?
CTS,
5 11100
Explain a few methods of overloading best practices in java?
What is the use of ioc in spring?
What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?
What is a native method in java programming?
What is inversion of control in spring?
What is an http server?
What is the use of using enum to declare a constant?
What is pojo in struts2?
How do I turn the auto-deployment feature off?
mention how many ways you can deploy the application in websphere?
Why hibernate is required?
What is diagmonagent?
How can an object be unreferenced?
when you will synchronize a piece of your code? : Java thread
How many boolean functions are there?