Guest User

Untitled

a guest
May 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. 21.08.2009 09:26:59 com.microsoft.sqlserver.jdbc.SQLServerConnection <init>
  2. SCHWERWIEGEND: Die Java-Laufzeitumgebung (Java Runtime Environment, JRE), Version 1.6,
  3. wird von diesem Treiber nicht unterstützt. Verwenden Sie die Klassenbibliothek
  4. 'sqljdbc4.jar', die Unterstützung für JDBC 4.0 bietet.
  5. java.lang.UnsupportedOperationException: Die Java-Laufzeitumgebung (Java Runtime
  6. Environment, JRE), Version 1.6, wird von diesem Treiber nicht unterstützt. Verwenden
  7. Sie die Klassenbibliothek 'sqljdbc4.jar', die Unterstützung für JDBC 4.0 bietet.
  8. at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:223)
  9. at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:840)
  10. at java.sql.DriverManager.getConnection(Unknown Source)
  11. at java.sql.DriverManager.getConnection(Unknown Source)
  12. at msSqlTest.DB.dbConnect(DB.java:13)
  13. at msSqlTest.TestConnection.main(TestConnection.java:7)
  14.  
  15. import java.sql.*;
  16.  
  17. public class TestConnection{
  18. public static void main(String[] args){
  19. // Neue DB und los geht's :)
  20. DB db = new DB();
  21. db.dbConnect("jdbc:sqlserver://localhost:1433/muff", "user", "pw" );
  22. }
  23. }
  24.  
  25. class DB{
  26. public void dbConnect( String db_connect_string,
  27. String db_userid,
  28. String db_password){
  29. try{
  30. Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" );
  31. Connection conn = DriverManager.getConnection(
  32. db_connect_string,
  33. db_userid,
  34. db_password);
  35. System.out.println( "connected" );
  36. }
  37. catch( Exception e ){
  38. e.printStackTrace();
  39. }
  40. }
  41. };
  42.  
  43. ResultSet objResultSet = objPreparedStatement.getResultSet();
  44. if (objResultSet == null) {
  45. boolean bResult = false;
  46. while (!bResult){
  47. if (objPreparedStatement.getMoreResults()){
  48. objResultSet = objPreparedStatement.getResultSet();
  49. bResult = true;
  50. }
  51. }
  52. }
  53. objCachedRowSet = new CachedRowSetImpl();
  54. objCachedRowSet.populate(objResultSet);
  55. if (CommonUtility.isValidObject(objResultSet)) objResultSet.close();
  56. objResultSet = null;
  57.  
  58. db.dbConnect("jdbc:sqlserver://localhost:1433/muff", "user", "pw" );
  59.  
  60. db.dbConnect("jdbc:sqlserver://localhostmuff", "user", "pw" );
  61.  
  62. db.dbConnect("jdbc:sqlserver://localhost:1433", "user", "pw" );
  63.  
  64. db.dbConnect("jdbc:sqlserver://localhost", "user", "pw" );
Add Comment
Please, Sign In to add comment