Creating Datasource using Java Studio
Hi,
I am creating Datasource from "runtime" tab and the select the database, giving it the url and appropriate setting.
I want to ask, will this datasource make appropriate changes to the tomcat server.xml file?
If i had to deploye the project, should i have to do it manually on deployment ?
[318 byte] By [
M.Ali.Amin] at [2007-11-26 9:32:24]

# 1
AFAIK, yes. The datasources that you create in the IDE, are only for intra-IDE usage. If you want it to appear on the server, you have to manually create it there.
# 2
emm, then would not it be better to make the changes in server.xml file directly before starting the project and since the ide is using the same tomcat, i can access those datasource?
one more thing about datasource (sorry if you feel if it is not part of this forum)
I know the configuration to be made in serverl.xml, but i am confuse how can i use them in java code, how will i get the connection and how will i RELEASE the connection.
# 3
> emm, then would not it be better to make the changes
> in server.xml file directly before starting the
> project and since the ide is using the same tomcat, i
> can access those datasource?
Possibly yes, but using tomcat as the storage for registered datasources is not something very desired I think.. Also registering a datasource in tomcat requires you to make sure that the JDBC driver is present in the server's classpath and that's a serous change which is not always welcome to be done automatically. Especially on production systems.
> one more thing about datasource (sorry if you feel if
> it is not part of this forum)
>
> I know the configuration to be made in
> serverl.xml, but i am confuse how can i use them in
> java code, how will i get the connection and how will
> i RELEASE the connection.
I'm not an expert on EE issues, but IIRC the connection is ultimately handled by the container - tomcat.
# 5
It depends on the complexity of the task. For smaller things I tend to use Class.forName(), since it's simpler; but as the application gets bigger, a datasource is definitely better, as you leave the connection hanling to the container.