You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yann C�bron <ya...@yahoo.de> on 2003/07/08 21:44:08 UTC
Re: Accessing database in java and jsp?
This might be a good start to read:
http://jakarta.apache.org/struts/faqs/database.html
HTH,
Yann
At 01:31 PM 7/8/03 +0200, you wrote:
>Hello
>
>I have created a datasource in my struts-config.xml. But I cant find out
how
>to use it. Creating my datasource in my web.xml works fine. Any tips?
>
>- Terje
>
>struts-config.xml:
>...
> <data-sources>
> <data-source>
> <set-property value="true" property="autoCommit" />
> <set-property value="My database" property="description" />
> <set-property value="com.sybase.jdbc2.jdbc.SybDriver"
>property="driverClass" />
> <set-property value="10" property="maxCount" />
> <set-property value="2" property="minCount" />
> <set-property value="xxxx" property="user" />
> <set-property value="xxxxx" property="password" />
> <set-property value="jdbc:sybase:Tds:mycomputer:4000/mydatabase"
>property="url" />
> </data-source>
> </data-sources>
>...
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: Accessing database in java and jsp?
Posted by Terje Hopsø <te...@online.no>.
Hi,
That works fine, thanks!
Now my next test is to get it into the sql-taglib. I tried to use the
data-source key="resDB" and use that but with no luck. I guess the
sql-taglib is looking at the web.xml. I only get "datasource invalid: null"
or "no suitable driver".
<sql:setDataSource var="ex" scope="application" dataSource="resDB"
/>
<sql:query var="rader" dataSource="${ex}">
select Initialer
from Skytter
</sql:query>
- Terje
-----Original Message-----
From: news [mailto:news@main.gmane.org] On Behalf Of Yann Cébron
Sent: 8. juli 2003 21:44
To: struts-user@jakarta.apache.org
Subject: Re: Accessing database in java and jsp?
This might be a good start to read:
http://jakarta.apache.org/struts/faqs/database.html
HTH,
Yann
At 01:31 PM 7/8/03 +0200, you wrote:
>Hello
>
>I have created a datasource in my struts-config.xml. But I cant find out
how
>to use it. Creating my datasource in my web.xml works fine. Any tips?
>
>- Terje
>
>struts-config.xml:
>...
> <data-sources>
> <data-source>
> <set-property value="true" property="autoCommit" />
> <set-property value="My database" property="description" />
> <set-property value="com.sybase.jdbc2.jdbc.SybDriver"
>property="driverClass" />
> <set-property value="10" property="maxCount" />
> <set-property value="2" property="minCount" />
> <set-property value="xxxx" property="user" />
> <set-property value="xxxxx" property="password" />
> <set-property value="jdbc:sybase:Tds:mycomputer:4000/mydatabase"
>property="url" />
> </data-source>
> </data-sources>
>...
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org