Forums Register Login

MysqlDataSource - some basic questions

+Pie Number of slices to send: Send
I'm using a SQL database in an application for the first time, since i'm not used to doing this
I'm a bit confused on what's the right way to do this...
at the moment i'm using a method to create a default "sqlConfig":





then i pass this model on to different methods to get certain information on different tables.
all these methods create a connection, create (or get) a different statement and execute it and then
closes the connection again.
If i go on like this, i guess i'll end up writing a few dozen (or more) methods for all the needed operations...
Is this the right way to go, or am i missing something again ?

edit: removed some not needed code for the example...
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 826 times.
Similar Threads
jdbc driver
JSP mySQL exception
looking for suggestions on better DAO design
Can you store a MySql DataSource into a Context?
spring jdbcTemplate connection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:12:24.