<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Terry.Li-彬

    虛其心,可解天下之問;專其心,可治天下之學;靜其心,可悟天下之理;恒其心,可成天下之業(yè)。

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      143 隨筆 :: 344 文章 :: 130 評論 :: 0 Trackbacks

     


    I've been testing Octopus for a couple of days and I think it's
    exactly what I was looking for.

    I have to load some data from a Sybase database (Adaptive server 12.5)
    to a PostgreSQL (7.4) one, without including all the columns and
    making some basic transformations.

    I don't have problems using the Loader and import definitions
    specifying the source and target tables. Nevertheless, I have a
    problem with the Timestamp fields: I'm loosing the hours, minutes and
    seconds. I'll try to explain it better:

    Source: Sybase
    Date format in conf/SybaseConf.xml
        
    <DateFormat>yyyy-MM-dd hh:mm:ss.SS</DateFormat>
    Original data
            2001-01-23 07:52:08.92
    Column data type
            datetime


    Target: PostgreSQL
    Date format in conf/PostgreSQL.xml
        
    <DateFormat>yyyy-MM-dd HH:mm:ss.SS</DateFormat>

    New data
            2001-01-23 00:00:00.00
    Column data type
            timestamp


    I tried to using CSV JDBC as target driver and see if it was a Sybase
    problem but it worked fine: the data in the CSV file was correct, with
    hours, minutes and seconds. Then I thought it was a PostgreSQL issue,
    so I used the CSV as the source driver and it also worked without
    problems.

    I enabled the P6Spy driver and turned on all the log messages to see
    if there were any problems with the date format but I didn't find
    anything. I also tried changing the date format in both drivers
    configuration without success.

    I'm sending the drivers configuration files and I list here my system
    configuration:

    PostgreSQL JDBC driver: 
    pg74.216.jdbc3

    Sybase JDBC driver:
    com.sybase.jdbc2.jdbc.SybDriver (jconn2d)

    Java VM version;
    java version "1.4.2_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)


    I don't know what is wrong, nor even where the problem is. Any
    suggestions would be appreciated.

    Regards,

    Juan Manuel Caicedo

    <?xml version="1.0" encoding="UTF-8"?>
    <LoaderConf>
    <!-- =======================================================================================
    LoaderGenerator Sybase database vendor configuration file.
    ======================================================================================== 
    -->
    <!--
    The Database type used to store ObjectId's and Version'c
    -->
    <OidDbType>DECIMAL (19,0)</OidDbType>
    <VersionDbType>SMALLINT</VersionDbType>
    <!--
    The OidDbColumnName, VersionDbColumnName are used for creating SQL CREATE TABLE
    statements in the create_tables.sql and <classname>SQL.sql files
    -->
    <OidDbColumnName>oid</OidDbColumnName>
    <VersionDbColumnName>version</VersionDbColumnName>
    <!-- ExcludeTables - defines system tables which you want to exclude for reading -->
    <ExcludeTables></ExcludeTables>
    <!-- DateFormat
    G  Era designator  Text  AD
    y  Year  Year  1996; 96
    M  Month in year  Month  July; Jul; 07
    w  Week in year  Number  27
    W  Week in month  Number  2
    D  Day in year  Number  189
    d  Day in month  Number  10
    F  Day of week in month  Number  2
    E  Day in week  Text  Tuesday; Tue
    a  Am/pm marker  Text  PM
    H  Hour in day (0-23)  Number  0
    k  Hour in day (1-24)  Number  24
    K  Hour in am/pm (0-11)  Number  0
    h  Hour in am/pm (1-12)  Number  12
    m  Minute in hour  Number  30
    s  Second in minute  Number  55
    S  Millisecond  Number  978
    z  Time zone  General time zone  Pacific Standard Time; PST; GMT-08:00
    Z  Time zone  RFC 822 time zone  -0800
    Example:
    "yyyy-MM-dd HH:mm:ss.SSS"    "2004-05-24 12:12:12.111"
    "yyyy.MM.dd G 'at' HH:mm:ss z"  "2001.07.04 AD at 12:08:56 PDT"
    "EEE, MMM d, ''yy"        "Wed, Jul 4, '01"
    "yyyyy.MMMMM.dd GGG hh:mm aaa"  "02001.July.04 AD 12:08 PM"
    If date format isn't given, default date format is "MM/dd/yyyy hh:mm:ss".
    -->
    <DateFormat>yyyy-MM-dd hh:mm:ss.SS</DateFormat>
    <!--  Driver name -Driver name-->
    <!--  ClassName - Driver class-->
    <!--  Connection - Connection for the database-->
    <!--  RequiredUser = "true/false" - if database requires ures and password for connecting-->
    <!--  FirstColumnResult = "0/1" - first column in result set-->
    <!--  EnableJumpInResult = "true/false" - if jdbc driver supports absolute(int) and relative(int) methods - jump in result set -->
    <!--  AfterLastRow = "true/false"  - if jdbc driver supports moving pointer after the last row in result set-->
    <!--  EnableOrderBy = "true/false" - if jdbc driver supports "order by" sql statements in sql commands.-->
    <!--  AlterTablePrimaryKey -defines if the database support ALTER TABLE sql statemnts for creating the pirmary key.-->
    <!--  MetaData -defines if the database support reading all meta data .-->
    <!--  RowCountEnabled -defines if the database support count(*) method for counting the rows in database table.-->
    <!--  SetFetchSizeEnabled -defines if the database support setFetchSize() method.-->
    <!--  SetCursorNameEnabled -defines if the database support setCursorName() method. -->
    <!--  SetEmptyStringAsNull - defines the possibility to convert an empty string to 'null' object or not-->
    <!--  ReadingOrderRelevant - defines if order of reading data from source database is relevant or not -->
    <!--  FileSystemDatabase - defines if this driver read/write on file system -->
    <!--  MaxConstraintLength - defines max length of the name of constraint (primary key,index,..) -->
    <!--  GetColumnsSupported - defines if this driver suport Connection.getMetaData().getColumns() method -->
    <!--  SetMaxRowsSupported - defines if this driver support java.sql.Statement.setMaxRows().Used for target database because of better performance. -->
    <Driver name="syb">
    <ClassName value="com.sybase.jdbc2.jdbc.SybDriver"/>
    <Connection value="jdbc:sybase:Tds:"/>
    <RequiredUser value="true"/>
    <FirstColumnResult value="1"/>
    <EnableJumpInResult value="true"/>
    <AfterLastRow value="true"/>
    <EnableOrderBy value="true"/>
    <AlterTablePrimaryKey value="true"/>
    <MetaData value="true"/>
    <RowCountEnabled value="false"/>
    <SetFetchSizeEnabled value="false"/>
    <SetCursorNameEnabled value="false"/>
    <SetEmptyStringAsNull value="false"/>
    <ReadingOrderRelevant value="false"/>
    <FileSystemDatabase value="false"/>
    <MaxConstraintLength value="-1"/>
    <SetMaxRowsSupported value="false"/>
    <GetColumnsSupported value="true"/>
    </Driver>
    <!--
    Here we map vendor-specific data types to JDBC types.
    Attributes:
    isBinary - attribute is used to determine is this type binary or not
    (isBinaryObject=true/false)
    isNumber - attribute is used to determine if type is number or not
    (isNumber=true/false)
    hasSize - attribute is used to determine if type has defined size or not(hasSize=true/false).
    This attribute is used by Octopus Generator. If attribute hasSize=false OctopusGenerator
    will generate sql scripts without size for this type.
    isDecimal - attribute is used to determine if type is decimal or not.
    (isDecimal=true/false)
    isDate - attribute is used to determine if this type is date.
    (isDate=true/false)
    isWithN - attribute is used to determine if this type need prefix N when using unicode characters.
    (isWithN=true/false)
    javaType - appropriate java type for this SQL type
    NOTE: If sql type has space in name, use __ instead of space: -e.g: <INT__IDENTITY
    -->
    <SQLType>
    <NONE javaType="java.lang.None">NONE</NONE>
    <INTEGER javaType="java.lang.Integer">INTEGER</INTEGER>
    <BIGINT isNumber="true" javaType="java.lang.Long">BIGINT</BIGINT>
    <DATETIME isDate="true" javaType="java.sql.Timestamp">TIMESTAMP</DATETIME>
    <MONEY isNumber="true" javaType="none">NONE</MONEY>
    <SMALLDATETIME isDate="true" javaType="java.sql.Timestamp">TIMESTAMP</SMALLDATETIME>
    <TINYINT javaType="java.lang.Byte">TINYINT</TINYINT>
    <BINARY isBinary="true" javaType="byte[]">BINARY</BINARY>
    <DECIMAL isDecimal="true" isNumber="true" hasSize="true" javaType="java.math.BigDecimal">DECIMAL</DECIMAL>
    <NCHAR hasSize="true" javaType="java.lang.String">VARCHAR</NCHAR>
    <SMALLINT isNumber="true" javaType="java.lang.Short">SMALLINT</SMALLINT>
    <VARBINARY isBinary="true" hasSize="true" javaType="byte[]">VARBINARY</VARBINARY>
    <BIT javaType="java.lang.Boolean">BIT</BIT>
    <FLOAT isNumber="true" hasSize="true" javaType="java.lang.Float">FLOAT</FLOAT>
    <NTEXT javaType="byte[]">BINARY</NTEXT>
    <SMALLMONEY isNumber="true" javaType="none">NONE</SMALLMONEY>
    <VARCHAR hasSize="true" javaType="java.lang.String">VARCHAR</VARCHAR>
    <CHAR hasSize="true" javaType="java.lang.String">CHAR</CHAR>
    <IMAGE isBinary="true" javaType="byte[]">LONGVARBINARY</IMAGE>
    <NVARCHAR javaType="java.lang.String">LONGVARCHAR</NVARCHAR>
    <LONGVARCHAR javaType="java.lang.String">VARCHAR</LONGVARCHAR>
    <TEXT javaType="java.lang.String">LONGVARCHAR</TEXT>
    <UNIQUEIDENTIFIER hasSize="true" javaType="none">NONE</UNIQUEIDENTIFIER>
    <CURSOR hasSize="true" javaType="none">NONE</CURSOR>
    <INT isNumber="true" javaType="java.lang.Integer">INTEGER</INT>
    <REAL isNumber="true" javaType="java.lang.Float">REAL</REAL>
    <TIMESTAMP isDate="true" javaType="java.sql.Timestamp">TIMESTAMP</TIMESTAMP>
    </SQLType>
    <!--
    Here we map JDBC types to vendor-specific data types.
    For almost all vendors, the JDBC types BIT, TINYINT, SMALLINT and BIGINT
    are mapped to the data type INTEGER.
    For most vendors, these types are actually INTEGER.
    The following entries can be changed to impose size restrictions.
    For example, to specify an actual size for a TINYINT, make the change:
    Database.JDBCtype.TINYINT.Oracle="DECIMAL(4,0)"
    Note that the "set" methods in the DO classes generated by DODS
    do not test for size restrictions on integer values.
    -->
    <JDBCType>
    <BIT>INTEGER</BIT>
    <TINYINT>INTEGER</TINYINT>
    <SMALLINT>INTEGER</SMALLINT>
    <INTEGER>INTEGER</INTEGER>
    <BIGINT>INTEGER</BIGINT>
    <REAL>REAL</REAL>
    <FLOAT>FLOAT</FLOAT>
    <DOUBLE>DOUBLE</DOUBLE>
    <NUMERIC>NUMERIC</NUMERIC>
    <DECIMAL>DECIMAL</DECIMAL>
    <CHAR>CHAR</CHAR>
    <VARCHAR>VARCHAR</VARCHAR>
    <LONGVARCHAR>TEXT</LONGVARCHAR>
    <BINARY>BINARY</BINARY>
    <VARBINARY>VARBINARY</VARBINARY>
    <LONGVARBINARY>LONGVARBINARY</LONGVARBINARY>
    <DATE>DATETIME</DATE>
    <TIME>DATETIME</TIME>
    <TIMESTAMP>DATETIME</TIMESTAMP>
    </JDBCType>
    </LoaderConf>

    <?xml version="1.0" encoding="UTF-8"?>
    <LoaderConf>
    <!-- =======================================================================================
    LoaderGenerator PostgreSQL database vendor configuration file.
    ======================================================================================== 
    -->
    <!--
    The Database type used to store ObjectId's and Version'c
    -->
    <OidDbType>DECIMAL (19,0)</OidDbType>
    <VersionDbType>BIGINT</VersionDbType>
    <!--
    The OidDbColumnName, VersionDbColumnName are used for creating SQL CREATE TABLE
    statements in the create_tables.sql and <classname>SQL.sql files
    -->
    <OidDbColumnName>ObjectId</OidDbColumnName>
    <VersionDbColumnName>ObjectVersion</VersionDbColumnName>
    <!-- ExcludeTables - defines system tables which you want to exclude for reading -->
    <ExcludeTables></ExcludeTables>
    <!-- DateFormat
    G  Era designator  Text  AD
    y  Year  Year  1996; 96
    M  Month in year  Month  July; Jul; 07
    w  Week in year  Number  27
    W  Week in month  Number  2
    D  Day in year  Number  189
    d  Day in month  Number  10
    F  Day of week in month  Number  2
    E  Day in week  Text  Tuesday; Tue
    a  Am/pm marker  Text  PM
    H  Hour in day (0-23)  Number  0
    k  Hour in day (1-24)  Number  24
    K  Hour in am/pm (0-11)  Number  0
    h  Hour in am/pm (1-12)  Number  12
    m  Minute in hour  Number  30
    s  Second in minute  Number  55
    S  Millisecond  Number  978
    z  Time zone  General time zone  Pacific Standard Time; PST; GMT-08:00
    Z  Time zone  RFC 822 time zone  -0800
    Example:
    "yyyy-MM-dd HH:mm:ss.SSS"    "2004-05-24 12:12:12.111"
    "yyyy.MM.dd G 'at' HH:mm:ss z"  "2001.07.04 AD at 12:08:56 PDT"
    "EEE, MMM d, ''yy"        "Wed, Jul 4, '01"
    "yyyyy.MMMMM.dd GGG hh:mm aaa"  "02001.July.04 AD 12:08 PM"
    If date format isn't given, default date format is "MM/dd/yyyy hh:mm:ss".
    -->
    <DateFormat>yyyy-MM-dd HH:mm:ss.SS</DateFormat>
    <!--  Driver name -Driver name-->
    <!--  ClassName - Driver class-->
    <!--  Connection - Connection for the database-->
    <!--  RequiredUser = "true/false" - if database requires user and password for connecting-->
    <!--  FirstColumnResult = "0/1" - first column in result set-->
    <!--  EnableJumpInResult = "true/false" - if jdbc driver supports absolute(int) and relative(int) methods - jump in result set -->
    <!--  AfterLastRow = "true/false"  - if jdbc driver supports moving pointer after the last row in result set-->
    <!--  EnableOrderBy = "true/false" - if jdbc driver supports "order by" sql statements in sql commands.-->
    <!--  AlterTablePrimaryKey -defines if the database support ALTER TABLE sql statemnts for creating the pirmary key.-->
    <!--  MetaData -defines if the database support reading all meta data .-->
    <!--  RowCountEnabled -defines if the database support count(*) method for counting the rows in database table.-->
    <!--  SetFetchSizeEnabled -defines if the database support setFetchSize() method.-->
    <!--  SetCursorNameEnabled -defines if the database support setCursorName() method. -->
    <!--  SetEmptyStringAsNull - defines the possibility to convert an empty string to 'null' object or not-->
    <!--  ReadingOrderRelevant - defines if order of reading data from source database is relevant or not -->
    <!--  FileSystemDatabase - defines if this driver read/write on file system -->
    <!--  MaxConstraintLength - defines max length of the name of constraint (primary key,index,..) -->
    <!--  GetColumnsSupported - defines if this driver suport Connection.getMetaData().getColumns() method -->
    <!--  SetMaxRowsSupported - defines if this driver support java.sql.Statement.setMaxRows().Used for target database because of better performance. -->
    <Driver name="postgresql">
    <ClassName value="org.postgresql.Driver"/>
    <Connection value="jdbc:postgresql://"/>
    <RequiredUser value="true"/>
    <FirstColumnResult value="1"/>
    <EnableJumpInResult value="true"/>
    <AfterLastRow value="true"/>
    <EnableOrderBy value="true"/>
    <AlterTablePrimaryKey value="true"/>
    <MetaData value="true"/>
    <RowCountEnabled value="false"/>
    <SetFetchSizeEnabled value="true"/>
    <SetCursorNameEnabled value="false"/>
    <SetEmptyStringAsNull value="false"/>
    <ReadingOrderRelevant value="false"/>
    <FileSystemDatabase value="false"/>
    <MaxConstraintLength value="-1"/>
    <GetColumnsSupported value="true"/>
    <SetMaxRowsSupported value="true"/>
    </Driver>
    <!--
    Here we map vendor-specific data types to JDBC types.
    Attributes:
    isBinary - attribute is used to determine is this type binary or not
    (isBinaryObject=true/false)
    isNumber - attribute is used to determine if type is number or not
    (isNumber=true/false)
    hasSize - attribute is used to determine if type has defined size or not(hasSize=true/false).
    This attribute is used by Octopus Generator. If attribute hasSize=false OctopusGenerator
    will generate sql scripts without size for this type.
    isDecimal - attribute is used to determine if type is decimal or not.
    (isDecimal=true/false)
    isDate - attribute is used to determine if this type is date.
    (isDate=true/false)
    isWithN - attribute is used to determine if this type need prefix N when using unicode characters.
    (isWithN=true/false)
    javaType - appropriate java type for this SQL type
    NOTE: If sql type has space in name, use __ instead of space: -e.g: <INT__IDENTITY
    -->
    <SQLType>
    <BIGINT isNumber="true" javaType="java.lang.Long">BIGINT</BIGINT>
    <BIGSERIAL hasSize="true" javaType="none">NOT SUPPORTED</BIGSERIAL>
    <BIT javaType="java.lang.Byte">BIT</BIT>
    <VARBIT hasSize="true" javaType="byte[]">BINARY</VARBIT>
    <BOOLEAN hasSize="true" javaType="java.lang.Boolean">BOOLEAN</BOOLEAN>
    <BOOL hasSize="true" javaType="java.lang.Boolean">BOOLEAN</BOOL>
    <BYTEA javaType="byte[]">BINARY</BYTEA>
    <CHAR hasSize="true" javaType="java.lang.String">CHAR</CHAR>
    <CHARACTER hasSize="true" javaType="java.lang.String">CHAR</CHARACTER>
    <VARCHAR hasSize="true" javaType="java.lang.String">VARCHAR</VARCHAR>
    <DATE isDate="true" javaType="java.sql.Date">DATE</DATE>
    <FLOAT8 hasSize="true" javaType="java.lang.Double">DOUBLE</FLOAT8>
    <INTEGER javaType="java.lang.Integer">INTEGER</INTEGER>
    <INT isNumber="true" javaType="java.lang.Integer">INTEGER</INT>
    <INT2 javaType="java.lang.Integer">TINYINT</INT2>
    <INT4 javaType="java.lang.Integer">INTEGER</INT4>
    <INT8 javaType="java.lang.Integer">INTEGER</INT8>
    <MONEY isNumber="true" javaType="byte[]">BINARY</MONEY>
    <DECIMAL isDecimal="true" isNumber="true" hasSize="true" javaType="java.math.BigDecimal">DECIMAL</DECIMAL>
    <NUMERIC isNumber="true" hasSize="true" javaType="java.math.BigDecimal">DECIMAL</NUMERIC>
    <REAL isNumber="true" javaType="java.lang.Float">REAL</REAL>
    <FLOAT4 hasSize="true" javaType="java.lang.Float">REAL</FLOAT4>
    <SMALLINT isNumber="true" javaType="java.lang.Short">SMALLINT</SMALLINT>
    <TEXT javaType="java.lang.String">LONGVARCHAR</TEXT>
    <TIME isDate="true" javaType="java.sql.Time">TIME</TIME>
    <TIMESTAMP isDate="true" javaType="java.sql.Timestamp">TIMESTAMP</TIMESTAMP>
    <TIMETZ isDate="true" hasSize="true" javaType="java.sql.Timestamp">TIMESTAMP</TIMETZ>
    <TIMESTAMPTZ isDate="true" hasSize="true" javaType="java.sql.Timestamp">TIMESTAMP</TIMESTAMPTZ>
    <BPCHAR hasSize="true" javaType="java.lang.String">VARCHAR</BPCHAR>
    </SQLType>
    <!--
    Here we map JDBC types to vendor-specific data types.
    For almost all vendors, the JDBC types BIT, TINYINT, SMALLINT and BIGINT
    are mapped to the data type INTEGER.
    For most vendors, these types are actually INTEGER.
    The following entries can be changed to impose size restrictions.
    For example, to specify an actual size for a TINYINT, make the change:
    Database.JDBCtype.TINYINT.Oracle="DECIMAL(4,0)"
    Note that the "set" methods in the DO classes generated by DODS
    do not test for size restrictions on integer values.
    -->
    <JDBCType>
    <BIT>BIT</BIT>
    <BIGINT>BIGINT</BIGINT>
    <BINARY>BYTEA</BINARY>
    <BLOB>BYTEA</BLOB>
    <BOOLEAN>BOOLEAN</BOOLEAN>
    <CHAR>CHAR</CHAR>
    <CLOB>BYTEA</CLOB>
    <DATE>DATE</DATE>
    <DECIMAL>DECIMAL</DECIMAL>
    <DOUBLE>FLOAT8</DOUBLE>
    <FLOAT>FLOAT8</FLOAT>
    <INTEGER>INTEGER</INTEGER>
    <LONGVARBINARY>BYTEA</LONGVARBINARY>
    <LONGVARCHAR>TEXT</LONGVARCHAR>
    <NUMERIC>DECIMAL</NUMERIC>
    <REAL>REAL</REAL>
    <SMALLINT>SMALLINT</SMALLINT>
    <TIME>TIME</TIME>
    <TIMESTAMP>TIMESTAMP</TIMESTAMP>
    <TINYINT>INT2</TINYINT>
    <VARBINARY>BYTEA</VARBINARY>
    <VARCHAR>TEXT</VARCHAR>
    </JDBCType>
    </LoaderConf>

    posted on 2008-02-24 12:43 禮物 閱讀(1377) 評論(0)  編輯  收藏 所屬分類: postgresql

    只有注冊用戶登錄后才能發(fā)表評論。

    網站導航:
     
    主站蜘蛛池模板: 亚洲日本天堂在线| 国产av无码专区亚洲av桃花庵 | 亚洲最大成人网色香蕉| 亚洲电影免费在线观看| 亚洲AV无码成人网站久久精品大| 亚洲精品无码精品mV在线观看| 亚洲中文字幕在线观看| 亚洲香蕉成人AV网站在线观看| 国产成人麻豆亚洲综合无码精品| 中文字幕中韩乱码亚洲大片| 亚洲色爱图小说专区| 亚洲国产一二三精品无码| 亚洲国产精品成人精品无码区在线| 亚洲成a人片在线观看无码专区| 亚洲av福利无码无一区二区| 777亚洲精品乱码久久久久久| 亚洲精品乱码久久久久久下载| 亚洲人成人77777网站不卡| 色老板亚洲视频免在线观| 最新国产精品亚洲| 色五月五月丁香亚洲综合网| 国产av无码专区亚洲av毛片搜| 久久久久免费视频| 国产好大好硬好爽免费不卡 | 苍井空亚洲精品AA片在线播放| 美女被艹免费视频| a级黄色毛片免费播放视频| 免费女人高潮流视频在线观看| 无码国产精品一区二区免费式影视 | 亚洲色图黄色小说| 亚洲色大成WWW亚洲女子| 边摸边吃奶边做爽免费视频99 | 亚洲美国产亚洲AV| 成年网站免费入口在线观看 | 成人亚洲国产va天堂| 国产99久久亚洲综合精品| 在线免费观看h片| 在线观看www日本免费网站| 在线观看国产情趣免费视频| 国产亚洲一区二区三区在线不卡 | 亚洲日韩国产精品乱|