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

推荐订阅源

IT之家
IT之家
博客园 - 聂微东
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 司徒正美
爱范儿
爱范儿
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
博客园 - 【当耐特】
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
人人都是产品经理
人人都是产品经理
V
V2EX

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