微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.sql.SQLNonTransientConnectionException的实例源码

项目:jdk8u-jdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t1);
    sqlNonTransientConnectionException ex1 =
            new sqlNonTransientConnectionException("Exception 2");
    sqlNonTransientConnectionException ex2 =
            new sqlNonTransientConnectionException("Exception 3",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u-jdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    sqlException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:Automekanik    文件ShtoKonsumator.java   
private void shto(){
    try {
        if (!txtEmri.getText().isEmpty() && !txtvendbanimi.getText().isEmpty() && !txtMakina.getText().isEmpty()
                && !txtMbiemri.getText().isEmpty()) {
            String em = txtEmri.getText().substring(0,1).toupperCase() + txtEmri.getText().substring(1,txtEmri.getText().length()).toLowerCase();
            String mb = txtMbiemri.getText().substring(0,1).toupperCase() + txtMbiemri.getText().substring(1,txtMbiemri.getText().length()).toLowerCase();
            String sql = "insert into Konsumatori (emri,mbiemri,makina,komuna,pershkrimi) values ('" + em + "'," +
                    "'" + mb + "','" + txtMakina.getText() + "','" + txtvendbanimi.getText() + "'," +
                    "'" + txtDesc.getText() + "')";
            Connection conn = DriverManager.getConnection(CON_STR,"test","test");
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
            conn.close();
            new Mesazhi("Sukses","Sukses","Konsumatori " + txtEmri.getText().toupperCase() + " " +
                    txtMbiemri.getText().toupperCase() + " u shtua me sukese");
        }else new Mesazhi("Info","","Fushat duhet te plotesohen per te vazhduar.");
    }catch (sqlNonTransientConnectionException fu){}
    catch (Exception ex){
        ex.printstacktrace();
    }
}
项目:Automekanik    文件ShtoPunetor.java   
private void shtoPunetoreMethod(){
    try {
        if (!emri.getText().isEmpty() && !mbiemri.getText().isEmpty() && !komuna.getText().isEmpty() && !pjesa.getText().isEmpty() &&
                !paga.getText().isEmpty() && !data.getEditor().getText().isEmpty() && !pw.getText().isEmpty()) {
            String em = emri.getText().substring(0,1).toupperCase() + emri.getText().substring(1,emri.getText().length()).toLowerCase();
            String mb = mbiemri.getText().substring(0,1).toupperCase() + mbiemri.getText().substring(1,mbiemri.getText().length()).toLowerCase();
            String sql = "insert into Punetoret (emri,pozita,paga,regjistrimi) values ('" +
                    em + "','" + mb + "','" + komuna.getText() + "','" + pjesa.getText() + "'," +
                    Float.parseFloat(paga.getText()) + ",DATE '" + data.getValue() + "')";
            String adminsql = "insert into Admin (emri,fjalekalimi,lloji) values " +
                    "('" + emri.getText().toLowerCase() + mbiemri.getText().toLowerCase() + "','" + pw.getText() + "',0)";
            Connection conn = DriverManager.getConnection(CON_STR,"test");
            Statement stmt = conn.createStatement();
            Statement AdminStmt = conn.createStatement();
            stmt.execute(sql);
            AdminStmt.execute(adminsql);
            conn.close();
            new Mesazhi("Sukses",em + " " + mb,"Punetori u shtua me sukses me daten " + data.getEditor().getText());
            stage.close();
        }else new Mesazhi("Info","Fushat duhet te plotesohen para se te vazhdoni");
    }catch (sqlNonTransientConnectionException fu){}
    catch (NumberFormatException nfw){new Mesazhi("Info","Gabim","Fusha qmimi duhet te permbaj vetem numra.");}
    catch (Exception ex){ex.printstacktrace();}
}
项目:Automekanik    文件ShtoPunetor.java   
private void rregullo(int id){
    try {
        if (!user.getText().isEmpty() && !pw.getText().isEmpty()) {
            String sql = "update Admin set emri = '" + user.getText() + "',fjalekalimi = '" + pw.getText() +
                    "' where id = " + id;
            System.out.println("ID: " + id);
            Connection conn = DriverManager.getConnection(CON_STR,"Te dhenat u ruajten me sukses. Ju lutem restartoni programin.");
            stage.close();
        }
        else new Mesazhi("Gabim","Fushat duhet te plotesohen para se te vazhdoni");
    }catch (sqlNonTransientConnectionException fu){}
    catch (NullPointerException npe){new Mesazhi("Info","Fusha qmimi duhet te permbaj vetem numra.");}
    catch (Exception ex){ex.printstacktrace();}
}
项目:openjdk-jdk10    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk-jdk10    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    sqlException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk9    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk9    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    sqlException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:gemfirexd-oss    文件TransactionTest.java   
public void Debug_tests_43222() throws sqlException {
  final Connection conn = getConnection();
  final Statement stmt = conn.createStatement();
  conn.setTransactionIsolation(getIsolationLevel());
  stmt.execute("create table warehouse (    w_id        integer   not null,"
      + "    w_ytd       decimal(12,2),"
      + "    w_tax       decimal(4,4),"
      + "    w_name      varchar(10)) replicate"+getSuffix());

  stmt.execute("alter table warehouse add constraint pk_warehouse "
      + "primary key (w_id)");

  stmt.execute("insert into warehouse values(1,0.0,'name1'),"
      + "(2,0.2,'name2')");
  conn.commit();

  int i = stmt.executeUpdate("UPDATE warehouse SET w_ytd = w_ytd + 4998.73 "
      + "WHERE w_id = 1");
  System.out.println(i);
  sqlNonTransientConnectionException ex = new sqlNonTransientConnectionException();
  System.out.println("ex.getsqlState returned: " + ex.getsqlState());
}
项目:jdk8u_jdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u_jdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    sqlException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:lookaside_java-1.8.0-openjdk    文件sqlNonTransientConnectionExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using Traditional while loop
 */
@Test
public void test12() {
    sqlNonTransientConnectionException ex =
            new sqlNonTransientConnectionException("Exception 1",t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    sqlException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:ade    文件ExtDataStoreUtils.java   
public static void handleConnectFailure(sqlNonTransientConnectionException e,String databaseUrl) { 

        logger.trace("handleConnectFailure( sqlNonTransientConnectionException )");

        boolean suppress = false;
        try {
            suppress = isdbnotFoundException(e);
        } catch (AdeInternalException i) {
            logger.error("Unable to determine sqlstate",i);
        }

        if (suppress) {
            logger.info("Suppress connection failure (nonexistent db),url: " + databaseUrl);
        } else {
            handleConnectFailure(e);
        }

    }
项目:cassandra-jdbc-wrapper    文件CassandraDataSource.java   
public CassandraConnection getConnection(String user,String password) throws sqlException
{
    Properties props = new Properties();

    this.user = user;
    this.password = password;

    if (this.serverName!=null) props.setProperty(TAG_SERVER_NAME,this.serverName);
    else throw new sqlNonTransientConnectionException(HOST_required);
    props.setProperty(TAG_PORT_NUMBER,""+this.portNumber);
    if (this.databaseName!=null) props.setProperty(TAG_DATABASE_NAME,this.databaseName);
    if (user!=null) props.setProperty(TAG_USER,user);
    if (password!=null) props.setProperty(TAG_PASSWORD,password);
    if (this.version != null) props.setProperty(TAG_CQL_VERSION,version);
    if (this.consistency != null) props.setProperty(TAG_CONSISTENCY_LEVEL,consistency);

    String url = PROTOCOL+createSubName(props);
    return (CassandraConnection) DriverManager.getConnection(url,props);
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,String)
 */
public void test_Constructor_LStringLString() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1","MYTESTSTRING2");
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent","MYTESTSTRING2",sqlNonTransientConnectionException
                    .getsqlState());
    assertEquals(
            "The reason of sqlNonTransientConnectionException set and get should be equivalent","MYTESTSTRING1",sqlNonTransientConnectionException
                    .getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be 0",sqlNonTransientConnectionException.getErrorCode(),0);

}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,String)
 */
public void test_Constructor_LStringLString_2() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,"MYTESTSTRING");
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent","MYTESTSTRING",sqlNonTransientConnectionException
                    .getsqlState());
    assertNull(
            "The reason of sqlNonTransientConnectionException should be null",sqlNonTransientConnectionException.getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be 0",0);
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,String,int)
 */
public void test_Constructor_LStringLStringI() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",1);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent",sqlNonTransientConnectionException
                    .getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be 1",1);
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,int)
 */
public void test_Constructor_LStringLStringI_1() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",0);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent",int)
 */
public void test_Constructor_LStringLStringI_2() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",-1);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent",sqlNonTransientConnectionException
                    .getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be -1",-1);
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,int)
 */
public void test_Constructor_LStringLStringI_6() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,sqlNonTransientConnectionException.getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be 1",int)
 */
public void test_Constructor_LStringLStringI_7() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,int)
 */
public void test_Constructor_LStringLStringI_8() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,sqlNonTransientConnectionException.getMessage());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be -1",-1);
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(Throwable)
 */
public void test_Constructor_LThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            cause);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The reason of sqlNonTransientConnectionException should be equals to cause.toString()","java.lang.Exception: MYTHROWABLE",sqlNonTransientConnectionException.getMessage());
    assertNull(
            "The sqlState of sqlNonTransientConnectionException should be null",sqlNonTransientConnectionException.getsqlState());
    assertEquals(
            "The error code of sqlNonTransientConnectionException should be 0",0);
    assertEquals(
            "The cause of sqlNonTransientConnectionException set and get should be equivalent",cause,sqlNonTransientConnectionException.getCause());
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(Throwable)
 */
public void test_Constructor_LThrowable_1() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            (Throwable) null);
    assertNotNull(sqlNonTransientConnectionException);
    assertNull(
            "The sqlState of sqlNonTransientConnectionException should be null",sqlNonTransientConnectionException.getsqlState());
    assertNull(
            "The reason of sqlNonTransientConnectionException should be null",0);
    assertNull(
            "The cause of sqlNonTransientConnectionException should be null",sqlNonTransientConnectionException.getCause());
}
项目:cn1    文件sqlNonTransientConnectionExceptionTest.java   
/**
 * @test java.sql.sqlNonTransientConnectionException(String,Throwable)
 */
public void test_Constructor_LStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING",cause);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The reason of sqlNonTransientConnectionException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLThrowable_1() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING",(Throwable) null);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The reason of sqlNonTransientConnectionException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,cause);
    assertNotNull(sqlNonTransientConnectionException);
    assertNull(
            "The reason of sqlNonTransientConnectionException should be null",Throwable)
 */
public void test_Constructor_LStringLThrowable_3() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            (String) null,(Throwable) null);
    assertNotNull(sqlNonTransientConnectionException);
    assertNull(
            "The sqlState of sqlNonTransientConnectionException should be null",*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",cause);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent",*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_1() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",null);
    assertNotNull(sqlNonTransientConnectionException);
    assertEquals(
            "The sqlState of sqlNonTransientConnectionException set and get should be equivalent",*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING",null,cause);
    assertNotNull(sqlNonTransientConnectionException);
    assertNull(
            "The sqlState of sqlNonTransientConnectionException should be null",sqlNonTransientConnectionException.getsqlState());
    assertEquals(
            "The reason of sqlNonTransientConnectionException set and get should be equivalent",*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_3() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING",null);
    assertNotNull(sqlNonTransientConnectionException);
    assertNull(
            "The sqlState of sqlNonTransientConnectionException should be null",*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_5() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,*       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_7() {
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            null,int,*       Throwable)
 */
public void test_Constructor_LStringLStringILThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlNonTransientConnectionException sqlNonTransientConnectionException = new sqlNonTransientConnectionException(
            "MYTESTSTRING1",1,1);
    assertEquals(
            "The cause of sqlNonTransientConnectionException set and get should be equivalent",sqlNonTransientConnectionException.getCause());
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。