Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #306 > unrolled thread
| Started by | "Starbuck" <starbuck@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:22 +0000 |
| Last post | 2011-04-27 15:23 +0000 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.java.databases
java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
Re: java and ms-server "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "David Harper" <david.harper@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Starbuck" <starbuck@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "John W Kennedy" <john.w.kennedy@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
Re: java and ms-server "Martin Gregorie" <martin.gregorie@THRWHITE.remove-dii-this> - 2011-04-27 15:23 +0000
| From | "Starbuck" <starbuck@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:22 +0000 |
| Subject | java and ms-server |
| Message-ID | <eLYMk.23884$7q6.21735@newsfe10.ams2> |
To: comp.lang.java.databases
Hi Folks
New to the group to sorry if this has been asked before.
I am learniing Java at Uni and so far I have connected to a MS Server
and I have read data ok. Now I want to connect to the stored procedures
already in place.
Below is a procedure in question -
CREATE PROCEDURE record_count
(
@cnt int OUTPUT
)
AS
BEGIN
/* Procedure body */
SELECT @cnt = count(8)
From curry
END
Nice and easy returns number of records in table.
Here is my working c# code
public int recCount()
{
try
{
openCon();
//not sure from here peeps
SqlCommand cmd = new SqlCommand("record_count", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter countParameter = new SqlParameter("@cnt", 0);
countParameter.Direction = ParameterDirection.Output;
cmd.Parameters.Add(countParameter);
cmd.ExecuteNonQuery();
int rc =
Int32.Parse(cmd.Parameters["@cnt"].Value.ToString());
if (con.State == ConnectionState.Open) con.Close();
return rc;
}
catch (Exception ex)
{
string exx = ex.Message ;
return 0;
}
}
Can anyone point me in the correct direction for the Java method please.
Many thankings in advance.
KC
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:22 +0000 |
| Message-ID | <490488fd$0$90271$14726298@news.sunsite.dk> |
| In reply to | #306 |
To: comp.lang.java.databases
Starbuck wrote:
> New to the group to sorry if this has been asked before.
> I am learniing Java at Uni and so far I have connected to a MS Server
> and I have read data ok. Now I want to connect to the stored procedures
> already in place.
>
> Below is a procedure in question -
> CREATE PROCEDURE record_count
> (
> @cnt int OUTPUT
> )
> AS
> BEGIN
> /* Procedure body */
> SELECT @cnt = count(8)
> From curry
> END
>
> Nice and easy returns number of records in table.
> Here is my working c# code
>
> public int recCount()
> {
> try
> {
> openCon();
> //not sure from here peeps
> SqlCommand cmd = new SqlCommand("record_count", con);
> cmd.CommandType = CommandType.StoredProcedure;
> SqlParameter countParameter = new SqlParameter("@cnt", 0);
> countParameter.Direction = ParameterDirection.Output;
> cmd.Parameters.Add(countParameter);
> cmd.ExecuteNonQuery();
> int rc = Int32.Parse(cmd.Parameters["@cnt"].Value.ToString());
> if (con.State == ConnectionState.Open) con.Close();
> return rc;
> }
> catch (Exception ex)
> {
> string exx = ex.Message ;
> return 0;
> }
> }
>
> Can anyone point me in the correct direction for the Java method please.
> Many thankings in advance.
It should be something like:
CallableStatement cstmt = con.prepareCall("{CALL record_count(?)}");
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.execute();
int rc = cstmt.getInt(1);
Arne
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Starbuck" <starbuck@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:22 +0000 |
| Message-ID | <fs0Nk.14132$pf1.8842@newsfe27.ams2> |
| In reply to | #307 |
To: comp.lang.java.databases
Arne Vajhoj wrote:
> Starbuck wrote:
>> New to the group to sorry if this has been asked before.
>> I am learniing Java at Uni and so far I have connected to a MS Server
>> and I have read data ok. Now I want to connect to the stored
>> procedures already in place.
>>
>> Below is a procedure in question -
>> CREATE PROCEDURE record_count
>> (
>> @cnt int OUTPUT
>> )
>> AS
>> BEGIN
>> /* Procedure body */
>> SELECT @cnt = count(8)
>> From curry
>> END
>>
>> Nice and easy returns number of records in table.
>> Here is my working c# code
>>
>> public int recCount()
>> {
>> try
>> {
>> openCon();
>> //not sure from here peeps SqlCommand cmd = new
>> SqlCommand("record_count", con);
>> cmd.CommandType = CommandType.StoredProcedure;
>> SqlParameter countParameter = new SqlParameter("@cnt", 0);
>> countParameter.Direction = ParameterDirection.Output;
>> cmd.Parameters.Add(countParameter);
>> cmd.ExecuteNonQuery();
>> int rc =
>> Int32.Parse(cmd.Parameters["@cnt"].Value.ToString());
>> if (con.State == ConnectionState.Open) con.Close();
>> return rc;
>> }
>> catch (Exception ex)
>> {
>> string exx = ex.Message ;
>> return 0;
>> }
>> }
>>
>> Can anyone point me in the correct direction for the Java method please.
>> Many thankings in advance.
>
> It should be something like:
>
> CallableStatement cstmt = con.prepareCall("{CALL record_count(?)}");
> cstmt.registerOutParameter(1, Types.INTEGER);
> cstmt.execute();
> int rc = cstmt.getInt(1);
>
> Arne
Arne
That is brill, many thanks
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Lew" <lew@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <lqqdnQOrKYUHP5nUnZ2dnUVZ_gGdnZ2d@comcast.com> |
| In reply to | #308 |
To: comp.lang.java.databases Starbuck wrote: > Arne > That is brill, many thanks Are you British? <http://en.wikipedia.org/wiki/Brill> -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "David Harper" <david.harper@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <jN1Nk.77931$E41.28187@text.news.virginmedia.com> |
| In reply to | #309 |
To: comp.lang.java.databases Lew wrote: > Starbuck wrote: >> Arne >> That is brill, many thanks > > Are you British? > > <http://en.wikipedia.org/wiki/Brill> His IP address is a Virgin Media address -- formerly NTL. That's a major U.K. broadband ISP. I should know. I get my Internet connection from them too. But brill is a small fish, no? ;-) David Harper Cambridge, England --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Starbuck" <starbuck@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <S_1Nk.72992$N11.27604@newsfe13.ams2> |
| In reply to | #310 |
To: comp.lang.java.databases David Harper wrote: > Lew wrote: >> Starbuck wrote: >>> Arne >>> That is brill, many thanks >> >> Are you British? >> >> <http://en.wikipedia.org/wiki/Brill> > > His IP address is a Virgin Media address -- formerly NTL. That's a > major U.K. broadband ISP. I should know. I get my Internet connection > from them too. > > But brill is a small fish, no? ;-) > > David Harper > Cambridge, England Quite correct old boy. Also short for brilliant when one is being lazy. Time for a cup of tea I think. How are you finding the Virgin media service David? Lew - I am English. Regards Kev --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "John W Kennedy" <john.w.kennedy@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <4904b0d6$0$28307$607ed4bc@cv.net> |
| In reply to | #311 |
To: comp.lang.java.databases Starbuck wrote: > David Harper wrote: >> Lew wrote: >>> Starbuck wrote: >>>> Arne >>>> That is brill, many thanks >>> >>> Are you British? >>> >>> <http://en.wikipedia.org/wiki/Brill> >> >> His IP address is a Virgin Media address -- formerly NTL. That's a >> major U.K. broadband ISP. I should know. I get my Internet >> connection from them too. >> >> But brill is a small fish, no? ;-) >> >> David Harper >> Cambridge, England > > Quite correct old boy. Also short for brilliant when one is being lazy. > Time for a cup of tea I think. > How are you finding the Virgin media service David? > > Lew - I am English. rO- ...and you write the pomes. rO4 -- John W. Kennedy "Compact is becoming contract, Man only earns and pays." -- Charles Williams. "Bors to Elayne: On the King's Coins" --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Lew" <lew@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <YLKdnQZaDcraUJnUnZ2dnUVZ_tydnZ2d@comcast.com> |
| In reply to | #312 |
To: comp.lang.java.databases Starbuck wrote: >>>>> That is brill, many thanks Lew wrote: >>>> Are you British? >>>> >>>> <http://en.wikipedia.org/wiki/Brill> David Harper wrote: >>> His IP address is a Virgin Media address -- formerly NTL. That's a >>> major U.K. broadband ISP. I should know. I get my Internet >>> connection from them too. >>> >>> But brill is a small fish, no? ;-) Starbuck wrote: >> Quite correct old boy. Also short for brilliant when one is being lazy. >> Time for a cup of tea I think. >> How are you finding the Virgin media service David? >> >> Lew - I am English. Many of us Americans are fascinated by the British way with English. Longing for the ancient home of the language, perhaps. I was not familiar with the usage of "brill" for "brilliant". Thanks for the education. I'm watching "football" on TV - only it's not soccer. -- Lew --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Martin Gregorie" <martin.gregorie@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:23 +0000 |
| Message-ID | <ge2nph$8pt$1@localhost.localdomain> |
| In reply to | #312 |
To: comp.lang.java.databases On Sun, 26 Oct 2008 16:04:23 -0400, Lew wrote: > Starbuck wrote: >>>>>> That is brill, many thanks > > Lew wrote: >>>>> Are you British? >>>>> >>>>> <http://en.wikipedia.org/wiki/Brill> > > David Harper wrote: >>>> His IP address is a Virgin Media address -- formerly NTL. That's a >>>> major U.K. broadband ISP. I should know. I get my Internet >>>> connection from them too. >>>> >>>> But brill is a small fish, no? ;-) > > Starbuck wrote: >>> Quite correct old boy. Also short for brilliant when one is being >>> lazy. Time for a cup of tea I think. >>> How are you finding the Virgin media service David? >>> >>> Lew - I am English. > > Many of us Americans are fascinated by the British way with English. > Longing for the ancient home of the language, perhaps. > > I was not familiar with the usage of "brill" for "brilliant". Thanks > for the education. > > I'm watching "football" on TV - only it's not soccer. > That's a locale-dependent term. Where I come from (NZ) football (or footy) means Rugby Union. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.databases
csiph-web