jdbc 3 « Database « Java Database Q&A





1. database & JDBC references    coderanch.com

You might find some interesting reading along this topic when searching for things like "database refactoring", "agile data", and "agile database". Of course, the issue of changing a database, and its effects on code that access/uses it is not unique to agile circles. Googling for things like "database change code effects" just might turn some useful things up.

2. Progress Database    coderanch.com

3. Database access for orinary people, ordinary PCs    coderanch.com

How do you access a database from a java program an ordinary desktop? I've practised doing it after installina database server. You start the server and then your programs work. But I can't ask each and every ordinary user to install a database server and start it up every time they want to use my program! I want to write a ...

4. problem with unicode database web application    coderanch.com

I'm trying to have a unicode enabled database for the web site I'm developing. The current installation is jdk1.4, postgres 7.3.2, jboss 3.2.3 on redhat linux9.0. The unicode seems to work well with normal jsp files with resource bundles. But when I try to input unicode characters into the database, the unicode data is not stored the way I expect. instead ...

5. DB Processing Cost    coderanch.com

Hi All, I need to return the following to my JSP page: A list of results from a single table (to use in a select box) A single result from the same table to display for editing. In this scenario, the list I return will always contain the single result I wish to display. My question is, which is the most ...

6. database    coderanch.com

8. Create a database programmatically?    coderanch.com

9. Is Noscroll a Database?    coderanch.com





10. Slow Database    coderanch.com

Anselm, I assume that "slow database" implies that it takes a long time for the database to return the results of queries. Usually this is due to badly written queries. By modifying the SQL of a particular query, you can sometimes change its execution time from hours to minutes. The other way to "enhance the speed of a slow database" is ...

12. Microsoft Access DB    coderanch.com

Depends what exactly you are talking about. If you have a server running on Windows accessing the Access DB, clients connecting to that server won't care. If you are connecting directly using JDBC, there are driver limitations that you will run up against (search this forum's history for details). If you want Access itself to run on anything other than Windows*, ...

13. To Get the Number of Matches Found in the Database    coderanch.com

I am working a database search by supplying a 'memberName'. There is a field in the data table called 'message_receiver'. I want to count the number if the 'memberName' and the 'messag_receiver' is a match and return the number. How do I do it? public int getNumberOfThreadBeans_forReceiver( String memberName ) throws AssertionException, DatabaseException { Connection conn = null; PreparedStatement stmt = ...

14. DB abstraction summary? Making sense of the offerings...    coderanch.com

Guys, There's an overwhelming amount of database abstraction/access libraries/frameworks/etc. available for Java. I'm returning to heavy Java db programming after years of absence (aside from some small code every now and then...), and don't really know where to begin. We used to write straight JDBC queries, but it seems the world has moved on, and I'd like to take advantage of ...

15. Database    coderanch.com

It depends on your needs. MySql is far away from standards, missing subqueries and loved by webhackers - because of it's silly name. If you're looking for an OpenSource Database which is a bit professional, have a look at postgresql. MSsqlServer is bad. A) it's from Micorsoft. B) it's bad. Once I was forced to use it, and made a query ...

16. Generalising Rownum for all DataBases    coderanch.com

Hi I have as issue with this rownum.This is supported in different forms in different databases like top in mssql ,limit in mysql and all..i want to genaralise this independent of the type of database because i want to run the query as i wont be knowing the type of the DB used by my user. can anyone suggest a solution ...





17. Elegant solution instead of polling database    coderanch.com

I have application A which updates DB and server B which reads data from DB. The server needs a way to get new data as soon as it becomes available. 1. Database polling? RRrrr I don't like that. 2. Make a intermediate module? Something like web service which is responsible for all DB access for both server and application. I don't ...

18. Database to multi-dimensional array problem    coderanch.com

I am trying to populate a multidimensional array with the number of records in a database that correspond to various application types. for some reason, i'm only getting values for the second row of the array.... If this description is vague, i apologize. here is my code: <% String appYear = request.getParameter("appyear"); String[] appName = { "Deposit Account App", "Loans", "Small ...

19. Converting database scripts.    coderanch.com

20. Need tool for export/import of database    coderanch.com

21. storing the Unicodes in the database    coderanch.com

I have some problem with Unicode datatype. I am storing the japanese charater in the Oracle 9i database. Taking input (japanese charater) from the browser and storing into the database. Ans also i retrieving back, the browser is showing the japanese charater properly. I have doubt in storing the japanese character in the database, will it be stored like this format ...

22. Compact Access Database    coderanch.com

24. Database Size    coderanch.com

I know this doesn't really have anything to do with java but I really would appreciate help with this. I'm planning a database which will at most have 1000 records with 20 fields, my estimations for its size are, well, tiny (i.e. few megabyte range at most). Am I right? I've never had to estimate database size before... (small-time, I know...) ...

25. Shared Database Access    coderanch.com

I only have access to a shared drive (no database server). If I put a MS Access Database on the shared drive and tried to access it from a Java program on at most three or so different PCs at the one time, how well would that work? Thanks for your help.

26. scalability in Database    coderanch.com

scalability n : the quality of being scalable. How well a solution to some problem will work when the size of the problem increases. For example, a central server of some kind with ten clients may perform adequately but with a thousand clients it might fail to meet response time requirements. In this case, the average response time probably scales linearly ...

27. Database portability    coderanch.com

Hi Chandana, JDBC2 has been around for 4-5 years now and, as such, I would expect that all major vendors have been supporting it for years. As I caveat to that, I'm not sure if there are areas of the specification that are optional. If that's the case then, in the interest of portability, you can either do your research, or ...

28. Book for database design    coderanch.com

Hello fellow ranchers, I am interested in learning/studying about database design. I had studied databases in school about 5-6 years ago, but now need to use databases in a professional environment. Could you please suggest some good books to start? We are currently using MySQL with Java as the programming language. Thanks!

29. suggestion for DB pool    coderanch.com

30. suggestions for a database for a live site to convert to?    coderanch.com

Short version: We need to switch over to a new database to back up our J2EE web app and we know very little about other databases and need suggestions for a good one for a small company like us. Long version: We are a small IT dept with only a couple of programmers, and the company's web app currently handles about ...

31. Exclusive access could not be obtained because the database is in use.    coderanch.com

Hi all, I have this err "Exclusive access could not be obtained because the database is in use". I disconnect the first connection and create another database connection but I have this error. firstly what I disconnect is static Connection con = null; static Connection con1 = null; if (con != null) { con.close(); } but I bitterly experiencd the error........ ...

32. Free DB modelling tools?    coderanch.com

33. what database to use on Windows 2000 Professional    coderanch.com

I've heard the Postgresql and Firebird databases spoken very highly of, though I've little personal experience with them. I'm sure there are versions of Weblogic and Websphere for the Win32 platform. Can you imagine IBM or BEA missing out on such a huge share of the market?! A quick search of their respective websites (e.g. download section) will allow you to ...

34. backup database    coderanch.com

Hi All I have to develop a Web Service that basically needs to backup one database onto another. The DB vendor is not static, it is determined by the database URL given by user when it invokes the WS. This backup is online one. When the WS gets the database URL, only then can it query it for its schema. In ...

35. Factory concept to provide DB transparency    coderanch.com

Hi All My software needs to connect to any database, whose name is provided dynamically at run time. I have java prg packaged as .jar files for kind of database which provide connection to it. The problem is i need to present a generic interface using Factory concept which should take care of interacting with the appropriate .jar file depending upon ...

36. Microsoft jet database engine and jdbc    coderanch.com

Have somebody solve the problem with jdbc and microsoft jet engine. I have an app that reads an excel file, it was working fine until I upgrade office 2000 to 2003. then I started getting the message: "Exception: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'comissTable2'. Make sure the object exists and that you spell ...

37. Database Metadata    coderanch.com

If it can't be done via DatabaseMetadata then, if you really need to do it, you'll need to use database-specific code. For example, in MS SQL Server and Sybase there is a system stored procedure called sp_helptext that does this (after a fashion). You might be better off selecting from the syscomments system table yourself, however. I think Oracle has views ...

38. Database for home PC    coderanch.com

39. database access    coderanch.com

40. DB Monitoring    coderanch.com

41. non-technical question: Rent a database space?    coderanch.com

Hi guys, I wonder if someone can help me on this non-technical question: I am a bit new to database and up until today my projects were running on a network so I used MS database with the ODBC connectivity. My client got bigger and he wants to have access to the database from different places in the world. I don't ...

42. howto modify database structure ?    coderanch.com

Ok this is my DAO. I hope you would be able to get logic atleast. method for adding fields in the existing table public void addColumn(ColumnBean bean, String sessionId) throws DBException{ Connection conn = DbUtil.getConnection(); PreparedStatement pStmt = null; Statement stmt = null; ResultSet rs = null; String tableName = "USER_DEFINED_COLUMN"; String query = "insert into "+tableName+" (COLUMN_ID, TABLE_ID, STATUS_ID," + ...

43. Check Database is running / not    coderanch.com

44. Check Instance of database running/not    coderanch.com

45. Need help. Special Characters() retrieval from the database using JDBC    coderanch.com

I am trying to retrieve Trademark() character from the database using java. The driver used is a Default DB2 JDBC Driver. When I retrieve registered () character, I am able to see it perfectly fine, but when I retrieve trademark () character, I get a question mark character (?). Please let me know what I would have to do to pick ...

46. Multiple database multiple conneciton problem.    coderanch.com

Dear All! Wht should i ve 2 do DBConnection class if i ve multiple databases. like i ve 1. dbAccount04 2. dbSale04 3. dbPurchase04 While working in dbAccounts i also have 2 get result from dbSale and dbPurchase in single form. plz be informed that these 3 database are changed yearly as u can c "04" at last. Plz guide me. ...

47. db access problem    coderanch.com

50. Complete JDBC 2.0 support and Free Database    coderanch.com

i don't know about full jdbc 2.0 support, but i do know that postgresql can be distributed with commercial products (and does have jdbc 2.0 support, i just don't know the extent). mysql is GPL, so if you use that you have to gpl all your source code for your product (something my old company chose not to do)

51. Access DB    coderanch.com

Hi, I am trying to update a row in a Access database, with the following query. "update inv set Flag='T' where uniq_id='"+uniq_id+"'"; I'm getting the following error:- org.apache.jasper.JasperException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. When I am trying the same query with oracle, it is working fine. Is there any syntax difference in Access? Grishma

52. Need a solution to convert the object get from a database into a public key    coderanch.com

Hi, friends, run the following code: import java.security.*; import java.sql.*; class keytesting { public static void main(String args[]) { keytesting k = new keytesting(); k.keytest(); } public void keytest() { try { String strSql; strSql = "SELECT pubkey FROM table1"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:jothi1"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(strSql); while (rs.next()) { Object obj; obj = rs.getObject("pubkey"); ...

53. Can we create databases from the code ?    coderanch.com

I think your problem might stem from the version of MySQL you are using. As I remember (you'll have to look this up though to check) versions 4.0 and below only support single-byte characters sets, it only from version 4.1 that MySQL's character encoding and set support dramatically improved. That being said, I always understood that you could store UTF-8 encoded ...

54. optimization of database    coderanch.com

you can create index on that column. if not. or assuming that your table primary key would be auto-number. you can generate your own primary key via code based on date format. and change the datatype to number rather than auto-number. this way you can apply the condition on your primary key. it will definitely improve your performance. i.e. YYYYMMDDHHMISSm where, ...

55. Check whether a value exists ina database or not    coderanch.com

Hi, tell me the easiest way to find whether a data exists in a database or not.The database is created in PostgreSQl.the code is written in servlet.Ac6tually my database table contains 5 columns.They are name company,designation,userid and password.I have to check whether user id and passsword exists in this database or not.Send me a reply as soon as possible. regarsds Sam ...

56. Database configuration    coderanch.com

Linda, I agree with you. Storing the formatting in the database limits your flexibility in the future. It is easy for a Java application to add in the formatting after you obtain the data. This is especially important if you ever have to support other formats or international phone numbers. What reasons are the others giving for storing the dashes?

57. cewolf with database sample code    coderanch.com

58. Database - how to increase the access time    coderanch.com

Hi friends, I have this simple class,which takes in query and returns the results.I don't know why the access is slow and it take(5-10 seconds) giving back the results.I don't know much about connection pool,can u just have a look at this simple class,and tell me if there's anything on which i can improve upon and where to add the(*.close() statements).The ...

59. Replacing name with first character in the DB    coderanch.com

Hi all i am trying to write a program that will query the database and thereafter update all the firstnames of the clients in the database to the first character of the firatname e.g a name in the database like vernon should now be v.this kind of a program should iterate through all the names in that database and update them ...

60. Replacing name with first character in the DB (code included)    coderanch.com

Hi all the following is code which needs to be factored so that the main method,when executed, the program can connect to the database known as art_server,look at all the firstnames in the database and replace them with their first character e.g name like vernon should finally appear as v.this type of mechanism should continue until all the records are dealt ...

61. Object Database    coderanch.com

62. Overview of Java database technologies    coderanch.com

63. sort Strings on app or database side?    coderanch.com

We have some queries that use ORDER BY, and our database guy is telling us to take them out and do them on the web app side to cut down on Oracle 10g's use of the TEMP table. Here's an example of a frequently run query that populates a quick access select box of their address book entries: SELECT ReceiverID FROM ...

64. How to retrive values from the database    coderanch.com

Sorry I by mistake fwd a previous incomplete reply: Well i tried hard but still i get the error as Null pointer exception , thats why now i try to send you my program. 1.name coonectionBean.java) Code: package supply; import java.io.*; import java.sql.*; public abstract class connectionBean { private String driver="sun.jdbc.odbc.JdbcOdbcDriver"; private String url="jdbc dbc:rushi"; protected Connection conn; public connectionBean() {} ...

65. Maintaining temporary database    coderanch.com

Hi! I have a application which does database administration. Here there is one table such that if the user updates it, he has to updtae a host of other tables else it will create inconsistency. So i need to carry all the data that is updated and finally after he is done, update the database. So how do i achieve that? ...

66. Database Functions    coderanch.com

It depends on your app. If you're writing a shrink-wrapped type of app, it would be beneficial to have it work with multiple RDBMSs. For large enterprise apps, most are written and designed as Oracle/Java or DB2/Java, etc.. type apps. The benefits of stored procedures will far outweigh db independence in most cases. For your last question: I would never count ...

67. Representing types in creational db code    coderanch.com

I'm looking for wisdom on the following situation. I have a fairly standard situation where one table in the database references another, with the latter table representing a set of type values. I have DAOs representing records from both tables, and I'm trying to work out the best way of using the types in a creational sense. For example, Record r ...

68. Java accessing a database?    coderanch.com

Can Java do it? If it can how do you go about doing it. For a final project for my class in Java(beginners), I want to have a program access and put information into and pull from a MySQL database then use that information to run the program. It's not really necessary for my idea but it would make the program ...

69. database    coderanch.com

70. Database coding best practices    coderanch.com

71. populating info into a new database ?    coderanch.com

I have created a database (MySql) for a client of mine and hes using it in conjunction with software I developed. From time to time I send him a new version of the software based on his request to improve the system in terms of more functionality. Sometimes the revisions include adding extra tables in the database so its a bit ...

72. Best Way to write application which can use different database    coderanch.com

Hello Currently my application is deployed on weblogice and the database is oracle. Now it is required to use DB2 . Can somebdy pl. tell me what will be the best practise so that in future if i have to use any other database I would nt be required to do a lot of coding. Right now the Queries are in ...

73. comparing database    coderanch.com

Hi All, I am doing a project using Java Swing in that the user datas will be stored in the MYSQL database through tables. Now that table contents in the database has to be compared with the Same MYSQL database fields. ie if the user is giving the "Name" the name should be in "Char". This should compare wheather the given ...

74. Model to add to a database    coderanch.com

Well I made that correction, and as before it compiles just fine, but crashes when the statement tries to execute. Here is my updated method: public void makeSale(Connection connection, saleBean sale) throws SQLException { StringBuffer template = new StringBuffer(); template.append("INSERT INTO sale (userID, date, ccType, ccNum, expiry, ccHolder, address, city, province, postal)"); template.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ...

75. storing objects in database    coderanch.com

76. Controlling Resul Set object to stop database process.    coderanch.com

suppose our JDBC result set object is retreving 10000 rows. Now certainly we got requirement that we need only 100 rows out of these 10000 rows, and we don't want to change the SQL. So if we start iterating a result object and just after getting 100 records we break the loop and close the statement object and result set object. ...

78. Builing Scalable Database Applications    coderanch.com

Hi, My name is Raja and I work in a telecommunications industry. We deal with lots of data everyday that represent customer phone calls. I have been writing applications using JSP, JAVA, Servlets and Postgresql database over years now to support this business. But we reached a stage where single database cannot do all the work. So I started to split ...

79. DB crashes when it's used simultaneous    coderanch.com

Hi, Im making a "back end" for an app. We have to save information about a person(id,name,value). It should be possible to insert and update a persons record, and return the 10 most valuable persons in the DB. Please note, that im using .asp (yes yes, I know ) and the DB is Access. Im posting here, because 1) im a ...

80. PDF to database    coderanch.com

Hello everyone, I dont know whether this is the rigth forum, i ve an application using swing. which take some input from user. I want that information store into database(SyBase) as pdf file, but i dont know how can i store it and recover it from database as pdf file. Should i ve to write first as pdf file and then ...

81. DB Locks    coderanch.com

I have the below archieture Action - Session Bean - DAO -DB I have configured transcation,"NOT REQUIRED" in the session bean. I am using MS SQL Server DB. (By Default the isolcation Level is READ COMMITED) Problem : 1. I get lots of problem with DB locks and dead locks while accessing the application concurrently 2. Get "no data available to ...

82. transferring database    coderanch.com

thanks for your help but there's 2 thing i want to ask : 1. when you said about generating a script, did you mean a programming scrip, sql server backup, or an excel/spreadsheet format of the tables? 2. if you meant generating a programming script from a sql server database, can you please mention the tool? thanks a lot for your ...

83. db for jdbc    coderanch.com

84. How much can a database bare?    coderanch.com

Hi...all I am working with a web based application and iam using jsp along with mysql, my project includes displaying of information retrived from database... My doubt is: Will it effect the performance of server... if i retrive large amount of data from the data base. Or should i consider storing my data in flat files..as there is not much quering ...

86. Looking for DB advice    coderanch.com

Hi all, Looking for some advice on which DB to use. I'm used to writing J2EE apps with MySQL using sqlyog as my sql gui but i want to embark on developing a desktop app which will need to have its own 'local' database. I havent really a clue on how to use this, one of my aims is to make ...

87. need info about hsql db    coderanch.com

88. need advise on db cleanup    coderanch.com

I've got several tables that are essentially log files who's data is irrelevant after a week or two, and I'm wondering if there is a "best practice" for cleaning up databases? I'm using a lot of Perl at the moment and am leaning toward throwing a script in cron that uses DBI to delete any thing older than X days or ...

89. Backing up database through java    coderanch.com

Hi to every one I have a doubt in java regarding creating the MySQL database dump. My problem is... i have a huge content in the database. i need to take a backup of the database on every day as i boot my system or as i open the application. i am right now using a MySql Database 4.1.12 version. i ...

90. database normalization    coderanch.com

Starting with the definition of Normalization, we must get rid of the redundant data and save space at the end. say user_info table user_id user_name state city country ------- --------- ----- ---- ------- 1 Urras xsss ci1 Alania 2 Anarres 1d212o ci2 Paflagonia 3 Doro sdsds ci3 Thrakia ... millions of records, on insert of which you must enter country name, ...

92. Binary Object to the database    coderanch.com

Blob b = null; int rows=0; PreparedStatement pstmt = null; try { rows = 0; pstmt = conn.prepareStatement( "select image from PROVIDERS "+ "where party_id = ? "); pstmt.setInt(1, 112); rset = pstmt.executeQuery(); if (rset.next()) { rows++; Blob b = rset.getBlob(1); inputStream is = b.getBinaryStream(); String fileName="pilo.png"; File file = new File(fileName); FileOutputStream fos = new FileOutputStream(file); int length =0; int ...

94. Database design for Role/User based access to the application..    coderanch.com

Hi All, We want to implement Role/User based access to the application. Can anyone tell me whats the optimized way of storing the data {User, Role, Access_Type etc} in the database.. The Roles might get added in the future so i dont want to maintain a single table to map User-Access_Type.. Access_Type --> AT_1 | AT_2 |AT_N | -------|-------|--------|------| User_1 | ...

95. Problem with AUTO_INCREMENT index reset when DB restarts    coderanch.com

I am using MySql 4.something. I am observing this behaviour - when the data table is emptied and then DB restarted auto_inc index is reset. I have a problem with this. Currently I am working on web app where every user can add and delete records from table. User A comes in and enters data which seen by User B. User ...

96. Database path    coderanch.com

97. Database Program - Web application    coderanch.com

Hi All, I am always having this doubt bouncing back into my mind everytime I read something about thread-safe issues. I have developed a web application which follows the MVC architecture although its not using Struts. I am just worried about my database program which performs database specific operations. This is my class... public class DcsDBManager { public DcsDBManager(){} public void ...

98. Configuring database on local machine    coderanch.com

Hi guys! Scenario: I am having two machines A and B. I am compiling my servlet.java files on machine A and copy-pasting the servlet.class files on the machine B. Obviously Machine A is client Machine B is server.... running tomcat server. Now, Query: I have a servlet that manipulates databases. Machine A(i.e. client itself) has MS SQL Server. How can I ...

99. Berkley Database    coderanch.com

100. What embeded database is available in market ?    coderanch.com

Hi Thank you for reading my post , I have to build an application for managing ADs something like phpAdnew which is a php+mysql application The problem is that server just support sql server and Mysql , so i have to choose between them or use an embeded database I did some investigation about Derby but now i want to see ...