Web服务连接 [英] Web service connection

查看:53
本文介绍了Web服务连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

了解Web服务如何与jsp页面交互。现在我只是想知道。在连接到数据库的Web服务中,它使用您指定的jdbc驱动程序创建数据源。如何使用@datasource连接到数据库并与数据库交互。 (使用netbeans 5.5)它的项目所以我不能使用其他任何东西

Figured out how the web service interacts with a jsp page. now i just want to know. in the web service when connection to a db it creates a datasource using the jdbc driver that you specified. How do you use that @datasource to connect to the db and interact with the db. (using netbeans 5.5) its a project so i cant use anything else

推荐答案

什么?


你在谈论也许提供不同的连接字符串以连接到数据库?


也许基于用户提供的凭证?
What?

Are you talking about maybe providing a different connection string in order to connect to the database?

Maybe based on user provided credentials?


好的,我知道如果我在两个方框中键入我的姓名,它会调用Web服务,然后返回HelloJonathan "迈耶" ;.现在,在那段确切的代码中,我将它连接到数据库并返回与我相关的所有信息(在sql where子句中比较我的姓名和姓氏)。这是我的代码,我做错了什么,有没有替代使用netbeans在Web服务中创建的jdbc驱动程序?
Ok, i got it so that if i typed my name and surname in two boxes, it calls the web service and then return Hello "Jonathan" "Meyer". Now in that exact piece of code i made it connect to the database and return all information associated to me(compares my name and surname in the sql where clause). here is my code, What am i doing wrong, and is there any alternative to using the jdbc driver that netbeans creates in the web service?
展开 | 选择 | 换行 | 行号


它看起来没问题,除了你的连接方式可能不正确。


请看 DriverManager类具体如何使用DriverManager'' s getConnection方法。


哦,你的SQL Select语句是错误的。您应该指定要从中选择的表。


所以第23行看起来应该是这样的:

Well it looks ok except for the way that you''re getting your connection might be incorrect.

Please look at the DriverManager class specifically how to use the DriverManager''s getConnection method.

Oh, and your SQL Select statement is wrong. You should be specifying the table to select from.

So Line 23 should look something like:

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于Web服务连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆