java amp 数据库事务,Java&本地数据库

TL DR; Want some Java help with connecting to a truly local database ( no access to server tech ), or if you can whip up code, that will work. All it has to do is query the DB ( MS Access, although can be changed ), and output a JSON string. See EDIT2 for more specificity.

EDIT: Before anyone says JDBC; I looked through the tutorials ( started reading in depth ), but most of it seems to be geared towards server tech, which I have no access to.

EDIT2: Seems most the answers so far are requiring an installation of some kind which I unfortunately cannot do ( and failed to mention, so I apologize ). However, this is what is currently being used and I would like a solution similar for Java that would make it more cross-browser compatible as opposed to being HTA only (link: https://launchpad.net/accessdb )

Okay, for the long version. I'm trying to make use of a local database to create a desktop style application for work ( and possibly make use of the knowledge for other projects ). The database I can create without a problem ( MS Access 2003, just happens to be quickly available ). Currently I'm using ActiveX scripting to work with the database in a HTML Application (*.HTA file works only with Internet Explorer), I would really like to make this more cross browser ( in the event the company EVER switches to an actual browser ) by using JAVA to access the database, then output the results in JSON to a local variable JavaScript can call and make use of.

Honestly would rather tutorial type information as I want to actually learn why this works so I can later modify it to suit my needs. I have Eclipse installed as well as JDK, and can right small programs in Java, so not completely brain dead ( but not far from :P ). I've been working with JavaScript so I can read quite a bit of Java code as it stands ( not the same syntax since they are not related, but the little I do know of Java I can translate back to JS without problem ).

Anyway, any assistance would be greatly appreciated. I can continue developing with ActiveX ( as I know that works on the system and I'm 99% sure they will continue using Internet Explorer, but, would like some flexibility ).

解决方案

I am not sure I understood your requirements very well, however I did decipher some key points. What I am suggesting will let you deliver a complete working application in a single package (say a JAR) that will not require much (if any) configuration or administration of servers.

Some Required skills:

Java programming langauge

JDBC, SQL

JSP and Servlets (for the Web tier)

I'm trying to make use of a local

database to create a desktop style

application [...]

I Want some Java help with connecting to

a truly local database ( no access to

server tech )

Datastore

JDBC can be used with any database that has a JDBC driver, which isn't necessarily a database in "network mode", it can be used with embedded databases as well.

Here is an example with Derby in embedded mode:

embedded.png

When an application accesses a Derby

database using the Embedded Derby JDBC

driver, the Derby engine does not run

in a separate process, and there are

no separate database processes to

start up and shut down. Instead, the

Derby database engine runs inside the

same Java Virtual Machine (JVM) as the

application. So, Derby becomes part of

the application just like any other

jar file that the application uses.

Figure 1 depicts this embedded

architecture.

Here are some 100% Java and embeddable databases:

Web tier

You can also embed a Web server like Jetty.

Jetty has a slogan "Don't deploy your

application in Jetty, deploy Jetty in

your application". What this means is

that as an alternative to bundling

your application as a standard WAR to

be deployed in Jetty, Jetty is

designed to be a software component

that can be instantiated and used in a

Java program just like any POJO.

Embedding Jetty.

Please note that there are other web servers that you can use this way.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值