随笔-244  评论-80  文章-1  trackbacks-3
  2009年7月28日
How to Write

Write Table

/Files/kentyshang/ErrorsAndWarningsTables.pdf

/Files/kentyshang/SQLTESTER.rar  这个工具很有用,可以用来测试你所写的SQL语句是否正确

/Files/kentyshang/ODBCTestApplications.pdf

/Files/kentyshang/Installation.pdf

还有好多,大家如果需要,可以留言或者加我qq。我发给大家!

MYOB的资料很少,搞得很辛苦嘞!
posted @ 2009-07-28 14:38 kenty 阅读(123) 评论(0) 编辑

Tomcat log file

 

stout_20090728.log:

========================

commandINSERT INTO  Import_Service_Sales(CoLastName,FirstName,AddressLine1,AddressLine2,AddressLine3,AddressLine4,InvoiceNumber,SaleDate,CustomersNumber,DeliverVia,DeliveryStatus,Description,AccountNumber,Amount,Job,Comment,Memo,SalespersonLastName,SalespersonFirstName,DeliveryDate,ReferralSource,TaxCode,NonTaxAmount,FreightTaxCode,FreightNonTaxAmount,FreightAmount,SaleStatus,CurrencyCode,ExchangeRate,PaymentIsDue,DiscountDays,BalanceDueDays,PercentDiscount,PercentMonthlyCharge,AmountPaid,PaymentMethod,PaymentNotes,NameOnCard,CardNumber,ExpiryDate,AuthorisationCode,DrawerChequeNumber,Category) VALUES ('Aadvark Advertising (H)',  ''        ,'Aadvark Advertising (H)',    '15B Golden Hill Mansion Wan Chai','Hong Kong','511458 020','00000023','2009-6-15','00000010','TNT','P','kenty test insert','11120','21.00','','Final Sale.','Sale; Aadvark Advertising (H)','Long, Alan','','2009-6-15','Advertisement','N-T','21.00','','','','Q','0','0','','','','','','21.00','','','','C050','','1','','')
java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.throwGenericSQLException(JdbcOdbc.java:7086)
    at sun.jdbc.odbc.JdbcOdbc.SQLTransact(JdbcOdbc.java:5601)
    at sun.jdbc.odbc.JdbcOdbcConnection.commit(JdbcOdbcConnection.java:700)
    at myob.servlet.Test.process(Test.java:50)
    at myob.servlet.ServletBase.doPost(ServletBase.java:50)
    at myob.servlet.ServletBase.doGet(ServletBase.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

 

 stderr_20090728.log:

======================================

Product Version: 5.60.0.3
OPENRDA_INI Configuration file: <C:\WINDOWS\openrda.ini>
Platform: IWINDOWS32
Build: Unicode

**********Contents of file:<C:\WINDOWS\openrda.ini>*********
[Common]
oa_root=C:\MYOBODBC
SchemaPath=C:\MYOBODBC\schema
Config=C:\MYOBODBC\config\iwinnt
CacheOptions=PATH=C:\MYOBODBC\cache;INITIAL_SIZE=10;INCREMENT_SIZE=5;MAX_SIZE=250;DATABLOCK_SIZE=64
CacheMemSize=8192
JoinInQueryOrder=1
SchemaUpdateAllowed=1
SQLEngineVerboseMode=0x00
SQLEngineVerboseTraceFile=C:\MYOBODBC\bin\iwinnt\oasqlverbose.log
EncryptionPackage=0
FETCHBLOCK_SIZE=100
SessPollWaitTime=20
JOINBLOCK_SIZE=10
[Client]
KeyFile=C:\MYOBODBC\config\iwinnt\oaclientkey.lic
TraceFile=
FETCHBLOCK_SIZE=100
PromptForUID=0
[TRACECLIENT]
All=FATAL|SNO|ERRORS
[ODBC32]
MessagePrefix=[MYOB ODBC]
TraceFile=
TraceOptions=0
PromptForUID=0
********************************************************

**********Contents of file:<C:\MYOBODBC\schema\oadrd.ini>*********
[test_local]
CONNECT_STRING=
TYPE=DB3
SCHEMA_PATH=.\test
REMARKS=Test DBase III IP source
[memory_local]
CONNECT_STRING=memory
TYPE=MEM
SCHEMA_PATH=
REMARKS=Test Memory IP source
[CTSL]
CONNECT_STRING=
TYPE=MYOB
SCHEMA_PATH=
REMARKS=
********************************************************

**********Contents of file:<C:\MYOBODBC\schema\oainfo.ini>*********
[DAM]
1=0
8=1
11=N
14=\
16=OpenRDA
17=OpenRDA
18=5.50.20.0
19=Y
20=Y
21=Y
22=0
23=2
24=2
25=N
26=1
27=Y
28=4
29="
30=128
31=128
32=128
33=128
34=128
35=128
36=Y
37=Y
38=Y
39=owner
40=procedure
41=.
42=NULL
43=9
44=1
45=table
46=2
47=OAUSER
48=0
49=16777215
50=16547839
51=3
52=630783
53=0
54=0
55=0
56=0
57=0
58=0
59=0
60=0
61=0
62=0
63=0
64=0
65=0
66=0
67=0
68=0
69=0
70=0
71=0
72=7
73=N
74=2
75=1
78=0
79=0
80=0
81=3
82=0
83=0
84=0
85=1
86=37867
87=Y
88=2
89=HINT,IDENTIFIED
90=N
91=15
92=7
93=4
94=*(){}|:;
95=31
96=3
97=0
98=0
99=0
100=0
101=0
102=0
103=N
104=0
105=32768
106=0
107=32
108=8192
109=0
110=0
111=N
112=8192
113=Y
114=1
115=73
116=0
117=0
118=1
119=0
120=0
121=0
122=0
123=0
124=0
125=0
126=0
127=0
128=0
129=0
130=0
131=0
132=1
133=0
134=1
136=0
137=0
138=0
139=0
140=0
141=1
142=0
143=1
144=0
145=0
146=1
147=0
148=3
149=0
150=0
151=0
152=1
153=2
154=2
155=7
156=2
157=2
158=3184
159=63
160=16135
161=592
162=3184
163=11
164=238
165=0
166=1
167=1
168=0
8194=.
8195=1
8196=15
8197=1
10000=1995
10001=2
10002=Y
10003=Y
10004=ISO=8859-1
10005=128
10022=0
********************************************************

**********Environment Variables  *********
OPENRDA_INI = <NOT_SET>
PATH = <c:\Program files\Intel\Wireless\Bin;C:\Program Files\Java\jdk1.6.0_02\bin;;C:\Program Files\Common Files\Thunder Network\KanKan\Codecs;>
LD_LIBRARY_PATH = <NOT_SET>
SHLIB_PATH = <NOT_SET>
CLASSPATH = <C:\Program Files\Java\jdk1.6.0_02\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_02\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_02\bin\;C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet.jar;C:\RmiJdbc\dist\lib\RmiJdbc.jar;>
ODBCINI = <NOT_SET>
********************************************************
CLI :  [TID: 864]:[Tue Jul 28 13:59:13.078 2009] rdacstmt.c:99: *** rda_cliAllocStmt: connection is not opened
SQLD:  [TID: 864]:[Tue Jul 28 13:59:14.156 2009] damdrv.c:881: sqldrv_commit(): IP endTransaction() returned error.
SQLS:  [TID: 864]:[Tue Jul 28 13:59:14.156 2009] sqlserv.c:501: *** sqls_commit: Unable to commit transaction.
CLI :  [TID: 864]:[Tue Jul 28 13:59:14.156 2009] rdacevnt.c:1256: *** procComitCnf: SQL_COMMIT caused a rollback. Error = 20016
CLI :  [TID: 864]:[Tue Jul 28 13:59:14.156 2009] rdacutl.c:831: *** RDA_cliCommit: can't execute R-Commit

 

 MYOBODBCError.txt

==========================================

Statement Error: 20016 Unable to determine if import has finished 

 

 

java连接方式:

 

 Connection con=null;
         Statement St=null;
         Driver driver=null;
         System.out.println("kenty test");
         try
            {
                driver = DriverManager.getDriver("jdbc:smileysurprised:dbc:CTSL");
                con = DriverManager.getConnection("jdbc:smileysurprised:dbc:CTSL");   
                con.setAutoCommit(false);     
                St= con.createStatement();

                 String command="INSERT INTO Import_Service_Sales(CoLastName,FirstName,AddressLine1,AddressLine2,AddressLine3,AddressLine4,InvoiceNumber,SaleDate,CustomersNumber,DeliverVia,DeliveryStatus,Description,AccountNumber,Amount,Job,Comment,Memo,SalespersonLastName,SalespersonFirstName,DeliveryDate,ReferralSource,TaxCode," +               "NonTaxAmount,FreightTaxCode,FreightNonTaxAmount,FreightAmount,SaleStatus,CurrencyCode,ExchangeRate," +
                "PaymentIsDue,DiscountDays,BalanceDueDays,PercentDiscount,PercentMonthlyCharge,AmountPaid," +
                "PaymentMethod,PaymentNotes,NameOnCard,CardNumber,ExpiryDate,AuthorisationCode," +
                "DrawerChequeNumber,Category) " +
                "VALUES ('Aadvark Advertising (H)',  ''        ,'Aadvark Advertising (H)',    '15B Golden Hill Mansion Wan Chai','Hong Kong','511458 020'," +
                "'00000023','2009-6-15','00000010','TNT','P','kenty test insert','11120','21.00','','Final Sale.','Sale; Aadvark Advertising (H)','Long, Alan','','2009-6-15','Advertisement','N-T'," +
                "'21.00','','','','Q','0','0'," +
                "'','','','','','21.00'," +
                "'','','','C050','','1'," +
                "'','')";
                System.out.println(command);
                int i=St.executeUpdate(command);
                System.out.println("Inserted =1111 ");
                con.commit();   


}          



最终发现原因,是在创建ODBC的时候,在File Access哪里需要选择Single user Access!

posted @ 2009-07-28 14:30 kenty 阅读(274) 评论(0) 编辑
    代码: 
Here is the code for a test application I use. The main difference that 
you must turn of Auto Commit and then pass the commit manually. However
you may still have to refer to the MYOBPlog.txt file for details of
errors.

import java.sql.*;

public class Main
{
static Connection con;
static Statement St;
static Driver driver;

public static void main(String[] args)
{
try
{
con = null;
St=null;

driver = DriverManager.getDriver("jdbc:odbc:AU12");

//---- DSN ----
con = DriverManager.getConnection("jdbc:odbc:AU12");

//----ADO ----
/*
String url="jdbc:odbc:Driver={MYOHK0901}; TYPE=MYOB; UID=Administrator; KEY=C:\\Plus13.hk_English\\861020904720.key; " +
"DATABASE=C:\\Plus13.hk_English\\CT Solutions Limited.myo;HOST_EXE_PATH=C:\\Plus13.hk_English\\MYOBP.exe; " +
"NETWORK_PROTOCOL=TCPIP; DRIVER_COMPLETION=DRIVER_NOPROMPT; " +
"ACCESS_TYPE=READ_WRITE;SUPPRESS_WARNINGS=TRUE;" ;
con =DriverManager.getConnection(url);
*/
*/

con.setAutoCommit(false);

St= con.createStatement();

for( SQLWarning warn = con.getWarnings(); warn != null; warn =
warn.getNextWarning())
{
System.out.println( "SQL Warning:" );
System.out.println( "State : " + warn.getSQLState() );
System.out.println( "Message: " + warn.getMessage() );
System.out.println( "Error : " + warn.getErrorCode() );
}

System.out.println("Inserted = "+St.executeUpdate("INSERT INTO
Import_Items (ItemNumber, QuantityBreak1, PriceLevelFQtyBreak1) VALUES
('101', 0, 234.48)" ));

con.commit();

St.close();

if(con!=null)
{
con.close();
}
}
catch (Exception ex)
{
try
{
System.out.println(ex.getMessage());
ex.printStackTrace();
if (St!=null)
{
St.close();
St=null;
}
if(con!=null)
{
con.close();
con=null;
}
}
catch (Exception ext)
{
System.out.println("2222-"+ext.getMessage());
}
}
}
}
posted @ 2009-07-28 14:24 kenty 阅读(95) 评论(0) 编辑
blog上的很多都是摘抄别人的知识点.如果是您的原创,而且不能盗版,那么请给我留言!谢谢!

有事请qq联系我!
每日口语
昵称:kenty
园龄:5年9个月
粉丝:5
关注:0
<2009年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

搜索

 
 

常用链接

最新随笔

我的标签

随笔分类

随笔档案

文章分类

文章档案

相册

SUN PORTAL

最新评论

阅读排行榜

评论排行榜

推荐排行榜