开发日记(数据库类型、数据库时间戳、java exception)

(一)数据库类型

mysql中的datetime可以转为postgres的date

(二)数据库时间戳

postgresql使用时间戳获取时分秒时间

1、select current_timestamp

2024-01-12 14:16:31.93339+08

2、select current_timestamp(0)  //去掉秒后面的位数,但仍有时区

2024-01-12 14:17:42+08

3、CURRENT_TIMESTAMP(0) ::timestamp without time zone //去掉时区

2024-01-12 14:19:23

(三)java Exception

1、最初用的Exception

try {
    System.out.println("Exception刚开始");
} catch (Exception ex) {
    ex.printStackTrace();
}

因为某些环节,要求必须写try catch,比如连接数据库

2、今天使用Exception

//主程序
try {
    System.out.println("今天的用法");
    System.out.println("第一个程序段,调用到了子程序段");
} catch (Exception ex) {
    a=false;
}

if(a==true){
    System.out.println("第二个程序段");
}

//子程序

private static String subFun(String dataSourceName, String tableName, String tableComment, Connection metaConn, Connection destConn) throws Exception  {
return null;}

注意:

1、Exception程序段可以改变变量的值,作为后续程序执行的判断

2、如果第一个程序段还调用了其他的程序,且也使服了Exception,那么就没法改变a的值

3、子程序调整方法:把try catch exception的写法,通过throws Exception来完成

数合建模,数据建模可视化工具,除了传统的数据分析外,算法模型部分通过python进行数据库和算法的交互,内置K近邻、多层感知器、弹性网络正则化等9种机器学习算法的成熟模型支撑相关场景

你可能感兴趣的:(java,mysql,postgresql)