Java Forum / General / December 2007
Connecting db through odbc bridge in tomcat 5.5
ruds - 22 Dec 2007 09:26 GMT Hi, I have installed tomcat5.5 and jdk1.6 on my machine which has Windows server2003 as OS. I'm not able to clearly underdstand the steps in tomcat docs (JNDI resources/ JDBC resources to be used for db access) for connecting to database and the changes to be made in different files. Can someone tell me detailed and clear steps for connecting to an ms access database through jsp using ODBC bridge? Thanks in advance for your suggestions.
TwelveEighty - 22 Dec 2007 21:30 GMT > Hi, > I have installed tomcat5.5 and jdk1.6 on my machine which has Windows [quoted text clipped - 5 lines] > access database through jsp using ODBC bridge? > Thanks in advance for your suggestions. Let me start by saying that building enterprise software on top of MS Access is a BAD idea, it's better to use a "grown up" database such as MS SQL, Oracle, MySQL. These databases all have native JDBC drivers, instead of using the ODBC bridge. MySQL is a free database and MS SQL 2005 Express as well, so costs should not be a factor.
I doubt that there is solid JDBC 2 driver capabilities in the JDBC- ODBC bridge, if any. For use in Tomcat, you would want to make use of the javax.sql.DataSource interface in concert with JNDI. Use Netbeans or some other IDE to check that the sun.jdbc.odbc.JdbcOdbcDriver class implements the javax.sql.DataSource interface. If it doesn't, I don't think you can use JNDI, connection pooling, etc. that Tomcat would otherwise take care of for you.You'd have to use the old style DriverManager in your code.
If JdbcOdbcDriver supports DataSource, create a new SQL datasource pointing to your database - there is a step-by-step instruction in the manual on how in jndi-resources-howto.html, "JDBC Data Sources". Step 2 will be the same, assuming you want to refer to your data as "EmployeeDB". Step 4 will need to reflect that you are using the ODBC bridge rather than the Hypersonic driver. Use driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" and url="jdbc:odbc:yourdsn" where yourdsn is the dsn name pointing to your access database.
Again, I don't think this would work with the ODBC bridge, but even if it did, I would recommend against it. Access is for storing personal CD collections, not for real-world applications.
David Segall - 23 Dec 2007 13:26 GMT >Let me start by saying that building enterprise software on top of MS >Access is a BAD idea, it's better to use a "grown up" database such as >MS SQL, Oracle, MySQL. These databases all have native JDBC drivers, >instead of using the ODBC bridge. MySQL is a free database and MS SQL >2005 Express as well, so costs should not be a factor. I'm sorry to be obsessive about this but I can't help correcting the claim that MySQL is free. If you mean it is open source then you are correct. However, unlike SQL Server Express, there are severe restrictions on who can deploy a MySQL database without paying for it. I have provided some more details and a comprehensive list of quality databases that can be freely deployed at <http://database.profectus.com.au>.
Lew - 23 Dec 2007 17:47 GMT >> Let me start by saying that building enterprise software on top of MS >> Access is a BAD idea, it's better to use a "grown up" database such as [quoted text clipped - 8 lines] > databases that can be freely deployed at > <http://database.profectus.com.au>. Besides, MySQL is not very good. Use Postgres or one of the other big players. All the other databases mentioned in the reference (excellent site, btw) are much better.
However, just because MySQL AB considers your product to be "linked" to their GPL database just because you use it, doesn't make it so. IANAL, but I would flout that phoney-baloney "restriction" in a heartbeat if I didn't think that their product sucks in the first place. I wouldn't worry too hard that "just *using* the database makes your application a derived work". OTOH, that the vendor wants to take such a position also puts them on my list of Bad People, and I certainly wouldn't want to divert my business's attention to defending against such a patently specious claim.
As far as I'm concerned, MySQL AB can go suck eggs. Guun dun, MySQL AB.
 Signature Lew
Arne Vajhøj - 23 Dec 2007 18:01 GMT > Besides, MySQL is not very good. MySQL since 4.1 is not that bad.
> However, just because MySQL AB considers your product to be "linked" to > their GPL database just because you use it, doesn't make it so. It is not just the database but also the JDBC driver that are under GPL (version 2 veas LGPL, but from version 3 they made it GPL).
If done properly - no use of MySQL classes, no hardcoded driver class name or URL, everything read from a config file - then I would also think MySQL had a weak case.
But most commercial ISV's would not take the chance.
And besides the same ISV's may want the support anyway.
Arne
TwelveEighty - 23 Dec 2007 20:48 GMT > If done properly - no use of MySQL classes, no hardcoded > driver class name or URL, everything read from a config file - then [quoted text clipped - 5 lines] > > Arne OK, time-out here. I was not aware of these issues with MySQL - I thought they were the good guys? Can someone explain what the deal with licensing issues with MySQL is?
What is that potential problem if I use MySQL as a database backend and use config files for storing of driver names and urls? Do I have to pay these guys now?
Arne Vajhøj - 23 Dec 2007 20:58 GMT >> If done properly - no use of MySQL classes, no hardcoded >> driver class name or URL, everything read from a config file - then [quoted text clipped - 11 lines] > and use config files for storing of driver names and urls? Do I have > to pay these guys now? The issue is that the MySQL JDBC driver is released under GPL license (with FLOSS exception).
It has some implications for usage, because the GPL license states that code "linked" to GPL code most also be GPL code (or in MySQL cases: at least be open source).
So: 1) if your solution is GPL or other source => no problem 2) if your solution is only used inhouse (not distribued) => no problem 3) in other cases you may have a problem
I have given some opinions of mine above.
But if your business depend on the answer them you should not take my word for it but consult an IP lawyer.
You can start reading here: http://www.mysql.com/company/legal/licensing/opensource-license.html http://www.mysql.com/company/legal/licensing/foss-exception.html http://www.mysql.com/company/legal/licensing/commercial-license.html
Arne
TwelveEighty - 23 Dec 2007 21:04 GMT > So: > 1) if your solution is GPL or other source => no problem [quoted text clipped - 10 lines] > http://www.mysql.com/company/legal/licensing/foss-exception.html > http://www.mysql.com/company/legal/licensing/commercial-license.html Thanks. Interestingly enough - wouldn't any commercial (closed source) software application that uses GPL software suffer from the same problem in your case 3? Or are there specifics in the FLOSS exception that makes life difficult here?
Arne Vajhøj - 23 Dec 2007 21:38 GMT >> So: >> 1) if your solution is GPL or other source => no problem [quoted text clipped - 14 lines] > software application that uses GPL software suffer from the same > problem in your case 3? Yes. The MySQL license is a standard GPL license just with the FLOSS exception added (to help PHP which is a huge MySQL user but have a non-GPL but still open source license).
> Or are there specifics in the FLOSS exception > that makes life difficult here? It is just a generalized "lex PHP".
Arne
ruds - 24 Dec 2007 09:10 GMT TwelveEighty, As u said I need to check if through ide whether my sun.jdbc.odbc.JdbcOdbcDriver class implements the javax.sql.DataSource interface, and use JNDI. Cant I connect to my db without JNDI? If so what steps need to be taken?
Lew - 24 Dec 2007 16:29 GMT > As u said I need to check if through ide whether my > sun.jdbc.odbc.JdbcOdbcDriver class > implements the javax.sql.DataSource interface, and use JNDI. > Cant I connect to my db without JNDI? Yes, you can, by using straight-up JDBC calls.
> If so what steps need to be taken? Start with <http://java.sun.com/docs/books/tutorial/jdbc/index.html>
Where the tutorial refers to Derby, e.g., in URLs "jdbc:derby:<dbName>...", you substitute the appropriate information for your scenario, e.g., "jdbc:odbc:<UserSrc>..."
GIYF, too.
 Signature Lew
Arne Vajhøj - 23 Dec 2007 17:57 GMT >> Let me start by saying that building enterprise software on top of MS >> Access is a BAD idea, it's better to use a "grown up" database such as [quoted text clipped - 8 lines] > databases that can be freely deployed at > <http://database.profectus.com.au>. MySQL uses a standard GPL license. So it is not so much a problem of deploying but more a problem of distributing.
Arne
David Segall - 24 Dec 2007 16:01 GMT >>> Let me start by saying that building enterprise software on top of MS >>> Access is a BAD idea, it's better to use a "grown up" database such as [quoted text clipped - 11 lines] >MySQL uses a standard GPL license. So it is not so much a problem >of deploying but more a problem of distributing. You are correct and I should have used "distribute" instead of "deploy". As far as I can tell there are no restrictions on the amount of money you can make by deploying GPL'd software. I wonder how MySQL AB would react if Sony started selling a MythTV <http://www.mythtv.org/> based consumer home theater PC.
Lew - 24 Dec 2007 16:26 GMT > I wonder how MySQL > AB would react if Sony started selling a MythTV > <http://www.mythtv.org/> based consumer home theater PC. As long as Sony makes the source code available ...
Or maybe they'd simply insist that the consumer download MySQL directly from MySQL AB for their own personal use with the Sony unit.
 Signature Lew
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|