惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
罗磊的独立博客
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
D
DataBreaches.Net
博客园 - 叶小钗
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
B
Blog
V
Visual Studio Blog
雷峰网
雷峰网
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

博客园 - kenty

“与”运算是什么意思 VSS 服务器端,客户端的配置 C#:GridView导出Excel,以及runat=server错误处理方法 MANIFEST.MF的用途(转载) 根据绑定的值的不同改变gridview里某一单元格的字体或背景颜色 css+div自动适应高度,在IE和firefox下都能适应 (左右DIV自适应高度) Response.Write()语句造成页面布局改变以及字体变化的解决办法 已经有2年没有接触代码了!重新回归,做个纪念吧! 关于忘记MySQL的root用户密码的问题 利用JDK1.5的工具对远程的Java应用程序进行监测(摘录) Visualvm 远程测试 问题 - kenty MYOB 的一些开发资料 连接MYOB ODBC,在MyEclipse 下Commit成功,在Tomcat下单独运行,Commit显示Connection 已经关闭 tomcat dbcp jndi 配置 JAVA 事务处理 jsp中文件下载的实现 - kenty - 博客园 META Header - kenty - 博客园 Proxy server 緩存 jsp html Putty对数据库进行备份及恢复
MYOB Developer Jave 创建连接
kenty · 2009-07-28 · via 博客园 - kenty

    代码: 

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());
}
}
}
}