Table 2 « Table « Java Database Q&A





1. Cannot create a new table    coderanch.com

I have a GUI set up so the user can enter SQl commands. I have two tables set up in an Access DB. I have been able to do query commands OK as well as insert and delete but have been having problems with drop table and create table. Everytime I try to create a table it says that table already ...

2. JDBC and non-indexed table    coderanch.com

Well, the reason the table is not indexed is because the table structure at my work is STUPID. But as you say if I am going to use getRowNum(), and try to delete record where more than one record is the same wouldn't it delete all the same records? Or should I just see if getRowNum() is more than 1 and ...

3. Static Table    coderanch.com

5. Listing out tables in a database    coderanch.com

6. how to display complete tables?    coderanch.com

7. Combination of tables    coderanch.com

8. Detect if table exists    coderanch.com

This should be easy, but I am unable to find it now. How can I detect if a particular table exists or not in my DB (I am using MySQL). I cannot delete table, so I can't use drop if exists; but can I use count (*) if exists, or sth similar? I am not much of a DB person. Any ...





10. getColumns() method on Databasemetadata returns empty for table synonyms    coderanch.com

i am using Oracle thin driver. Infact i am able to retrieve columns for table synonym,i set the property setINcludeSynonyms(true) on oracle.jdbc.driver.OracleConnection from ther eit works fine. Now when i am trying to get Primary keys through table synonym.I am getting empty result set for it.Please let me know if you have any solution for it. Thanks

11. Moving Through a result Set on two tables    coderanch.com

I have a problem with setting up my result set and when I query the database, I have two tables and they are linked by a common column name so I have to designate which one I call to the but when I set my second query to the second table I get a query already open error, because I queryed ...

12. Table Structure(s)    coderanch.com

In my application I am able to search Issues. On this search page I have different search critiera deemed the Search Filter. I want the user to be able to save a defined filter. So I am starting to put together my table(s) for saving the filter. My filter class contains the following members: Long filterId - ID of the filter ...

13. Table getting Dropped    coderanch.com

14. Cloudscape Tables    coderanch.com

15. Replicate tables    coderanch.com

Hello, We were using db v7.1 before but now, we are upgrading to v7.2 , there were some tables in v7.1 that we want to bring into v8.0 wit the data in it. I tried making a batch file that would export stuff from 7.2 and impor t it to 8.0 but it's only bringing in some of the rows not ...

16. creating a table from the application. is it Inefficient ?    coderanch.com

assuming i have upgraded my database with a create table statment. this statment is called from the program everytime the user is requested to do somthing. question: is it inefficient to "create table" more than once just to make sure the table exist? of course, if the table exist...I continue with insert/update/etc (thanks to try & catch) but the checking of ...





17. Generating Huge Table    coderanch.com

I need to generate a huge table from reading a another huge input table. Here is the requirement: 1. Read a row from the input table, do calculation, generate a target row. 2. The generated target row may or may not be generated before i.e. the same PK may already be generated by a previous input row. 3. If the PK ...

18. Detect if a table exists    coderanch.com

I am writing an application that uses JDBC to connect to a database. I want to create the necessary tables when the application starts, but only if the tables dont' exists already. Is there a generic way to use JDBC to detect if a certain table exists? I think there is a way using the database's metadata tables and select statements, ...

19. Check table contents ?!!    coderanch.com

20. How to alter table    coderanch.com

21. how to get the table constraints?    coderanch.com

yes,there is nothing in the Java api that can give the constraints set on a table. I have already used the DatabasemetaData and am able to get the primary keys, foriegn keys. But what I need is the unique keys and constraints in the table. The only way I see now is to query the system catalog tables and get the ...

22. DROP table question    coderanch.com

In the following code I am trying to DROP table from a sql DB: public class SQLServerInitTest extends TestCase { static String[] DB_TABLE = {"POI"}; /* * @getConnect */ public Connection getConnection(){[t][t] // Make connection to a SQL Server 2000 database. Connection con = null; try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ HOST_NAME +":1433;DatabaseName="+ DB_NAME +";User="+ USER_NAME +";Password="+ PASSWORD +""); } catch ...

23. Newbie Question - how to use different table    coderanch.com

I used this tutorial in apache server http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html everything is working fine. but now, i want to play with it to understand it better. I created a different table and want to use it. I changed all the codes that seems to have a connection but still i get the error message "Table 'javatest.users' doesn't exist" obviously javatest was the old ...

24. tables in the database    coderanch.com

25. registerOutParameter for table?    coderanch.com

I have a record and table of type this record TYPE owner_Rec IS RECORD ( ssn CHAR (9), NAME VARCHAR2 (60), address VARCHAR2(120) ); TYPE Owner_tbl IS TABLE OF owner_Rec INDEX BY BINARY_INTEGER; This I am sending as an out parameter in my stored procedure. How should i access this table in my java code , what should i mention in ...

26. Weird number been put to DB table through JDBC    coderanch.com

Just try to put a record to the following to DB table: Table layout: PO_SHIPMENTS (PO_ID NUMBER (15) NOT NULL, PO_REVISION_ID NUMBER (15) NOT NULL, SHIPMENT_NUM NUMBER (10) NOT NULL); String insertSql = "INSERT INTO POLC_PO_SHIPMENTS ( PO_ID, PO_REVISION_ID,SHIPMENT_NUM)"; public void createShipment() { // Create Ship Record PreparedStatement stmt = null; PreparedStatement bolStmt = null; try { stmt = conn.prepareStatement(insertSql); stmt.setInt(1, ...

27. A stange error while storing single quote in a table    coderanch.com

That's common copying from MS Word. Word doesn't use standard single quotes (sometimes). If you look on screen or in printing carefully you may see that balanced single quotes around a word slant inward at both ends. I think you can turn this off (look for smart quotes in Word help) but if you can't force users to do that you ...

28. creating virtual tables    coderanch.com

I've a trouble here in jdbc.. i'm using jsp with oracle.. now.. i want to create a table for that i'm using create table

now what i want to do is.. i've a html file.. in that.. there is a text box.. when i click the button in that file.. the string i entered .. will be carried to ...

"); } } ...

29. creating table on client side    coderanch.com

Or, perhaps, you want the database to create a temparary table for a specific user. (I think Oracle can do that -- you'd have to check the Oracle documentation/consult an Oracle DBA for exactly how). Otherwise, I would suggest using something like HSQL or some such. If you can explain why you need it, we might be able to come up ...

30. size of table is increasing    coderanch.com

The problem with MS Access database is that it doesn't automatically resize the file if the records are deleted. You need to compact it manually Tools -> Database Utilities -> Compact & Repair Database Or alternatively you can make Access to compact the database everytime it is closed. Tools -> Options -> General -> Check "Compact on Close" option As far ...

31. Database Tables    coderanch.com

33. [root@localhost:3306] ERROR 1146: Table 'xxx.1' doesn't exist    coderanch.com

i m using mysql version(5.016,server).and mysqlcc 0.94(beta). when i m going to create a table in database(biswajit) i m getting an error like [root@localhost:3306] ERROR 1146: Table 'biswajit.1' doesn't exist.though i m able to creat a table say(xyz) in the database(biswajit) but after insertion of datas in the table the datas remain nolonger valid.ie data becomes empty after i come out ...

34. table access    coderanch.com

35. How many Tables can contain in One DB    coderanch.com

36. Is it a bad practice to put all addresses into one table?    coderanch.com

Originally posted by Ivan Jouikov: Say I have 2 objects: Client and Supplier. And you're not going to have an Address object? Why not? Are you going to essentially identical methods for dealing with a Client's address and a Supplier's address? Bad design... And once you realize that you should have an Address object, doesn't your question answer itself? And of ...

37. Temporay tables -- cause problems?    coderanch.com

Hi, Are there any problems using temporary tables in a multi-user application? I am creating a temporary table and then using it to generate other column results (that would have been very difficult in a single query). I think I read that the temp tables are kept separate for each user. Look forward to any and all replies. Thanks. - Mike ...

38. Create table using JDBC    coderanch.com

Steve, Are there a lot of database types? It seems like it would be easier to have an object (like a 2-d map) that looks up the proper database type for the given Java data type. This object could be loaded from a file to make it easier to change. It would also support complex data types just as easily.

40. Database Migration (Migrating only Tables, leaving Views)    coderanch.com

Hi Im doing a Database Migration from HSQL to DERBY.. I need to migrate only the tables in the HSQL to DERBY.. But when I use the following code : ...... ...... ...... String[] types = new String[]{"TABLE"}; ResultSet resultSet = dbmd.getTables(null, null, "%", types); while (resultSet.next()) { String sourceTableName = resultSet.getString("TABLE_NAME"); ResultSet results = dbmd.getPrimaryKeys(null, null,sourceTableName); ....... ....... ....... The ...

41. Get Maximum sal from emp table    coderanch.com

Hi All.. How to get second maximum sal from emp table... for example emp sal === ==== 10 4000 20 1000 30 5000 40 9000 50 6000 from this table i want to get the second maximum sal example data : 50 6000, can you reply anybody... ============================================================================ Thanks in Advance P.Arjun

43. What is the problem with a big table?    coderanch.com

According to my business rules it is enough for me to have a single database table. I also like to have a single table because it is easy to apply data retreval SQL quries on a single table.(without JOINing many tables) But I have more than 60 columns, is it acceptable to have that amount of columns in a single table? ...

44. Acces table    coderanch.com

I'm fairly new to java and I'm trying to make a simple program that accesses some data from a table. The table has about 12 columns and 100 rows and consists exclusively out of numbers. The rows are linked to each other and using data from one column I want to be able to access the data of an other column ...

45. how to extract parents and childs from a table with self reference?    coderanch.com

Hi Thank you for reading my post. I have a Category table which contains all categories and there is field for each record to show the parent of that categories. some categories has no parent so they are roo categories which has -1 as thier parentCategoryID. now i should extract each category and its childs. here is my way: -select all ...

46. Tables to cross-reference state-city-postal codes?    coderanch.com

I want to be able to match state-city-postal codes. So if a user enters a city\state, I can give them the correct zip codes for that area. Or the correct list of cities based on a zip. I would also like to do radii matches. So if someone in a city-state-zip wants a list of others within a certain radius, I ...

47. Returning a table into an array.    coderanch.com

I have been trying all night to do this. I have a table on a server and I can get my code to either return one name anywhere in my array, or get one name to fill the whole array. What I want is to get each name from the database is a new array field. Here is my method I ...

48. CHECK IF A TABLE ALREADY EXISTS    coderanch.com

Thanks to you all. It works. Now i want to get all the tables in the database or just count the number of tables exists in my database. How do i do it. Iv got a code and when i execute it, i get an error saying that the feature is not present in my ACCESS DATABSE. Please help me out ...

49. COUNT/LIST the number of tables in ACCESS    coderanch.com

i want to get all the tables in the database or just count the number of tables exists in my database. How do i do it. Iv got a code and when i execute it, i get an error saying that the feature is not present in my ACCESS DATABSE. Please help me out for new codes or for the prob. ...

50. regarding dual table    coderanch.com

Dual is a place holder, nothing more. It exists as a table containing one column called dummy with the value x. You use it to return constant values, such as the value of a sequence. The reason you use dual is it is guarenteed to only ever have one row and it is visible to all users.

51. Normalised/denormalised database tables    coderanch.com

Database normalization is the process of structuring your data according to the relational theory. Wikipedia has a nice explanation of normalzations, and the steps to normalize a database. Normalization focuses on the structure of your database. It may be that this optimal structured database does not meet your performance requirements. You can take a step back, and make a choice between ...

52. Create table error    coderanch.com

Amar, I saw that. The variable explains the double quotes (for Java). The single quotes are only used for SQL and are not needed for a table name. It should be: create table "+emp_id+".. not: create table '"+emp_id+"'.. What error are you getting when you run the statement at the database command line?

53. create table auto_increment    coderanch.com

its a standard database delivered with netbeans tool.i have installed: Java Platform, Enterprise Edition 5 (Java EE 5) Tools Bundle, Multi-language Be among the first to take advantage of the ease-of-development features in Java EE 5! The Java EE 5 Tools Bundle, Multi-language is a complete, developer-friendly environment with all necessary runtimes installed and fully configured. Java EE 5 Tools Bundle, ...

54. Drop tables recursively    coderanch.com

I need to drop a group of tables, whose names are started with MY_. Because the number of the table is very large (around 200), I want to do it recursively. Here is the SQL with subquery, but it is not working. DROP TABLE (select TABLE_NAME from ALL_TABLES where TABLE_NAME like 'MY_%') CASCADE CONSTRAINTS PURGE; Any suggestions? Any Oracle (PL/SQL) functions ...

56. how to related two tables    coderanch.com

i have a simple user login and use this code to make two tables CREATE TABLE user_log ( user_id INT PRIMARY KEY AUTO_INCREMENT, user_nick VARCHAR(20) UNIQUE NOT NULL, user_password VARCHAR(20) NOT NULL, role_id int ); CREATE TABLE role_id( role_id INT PRIMARY KEY AUTO_INCREMENT, role_name VARCHAR(20) NOT NULL ); I wont when I try to user_log.role_id to make call to role_id.role_name or ...

57. Creating tables    coderanch.com

A primary key is a lot more than just a non-null, unique field. The primary key is the field (or group of fields) which serve to uniquely identify a row. By declaring a primary key you are giving the database lots of information about how the table is structured and which columns depend on which others. Primary key fields are almost ...

58. JDBC compare the content of two tables    coderanch.com

Hello everyone, I am using JDBC to compare the content of two database tables -- writing a general function and two tables are input. The two tables have various types of columns, like VARCHAR, BLOB, INT, FLOAT, etc. I want to save my time to write various statements to get values by different types and compare them, for example, for VARCHAR, ...

59. construct complex table view    coderanch.com

hi guys, we want to generate a mysql view table to use it for Full text search here's what we want to do : select title & description from a table (mods) also use a field as a concatenated list of "tags" (table mod_tags) so if tag rows for mod_id = 62 are: bird firetruck hamburger we should find those three ...

60. Problem with stored procedure table parameter    coderanch.com

Hello, I have the problem with stored procedure with paramater which is table type. I have defined my own type CREATE OR REPLACE TYPE STRING_LST AS TABLE OF VARCHAR2(80); and i have stored procedure like this PROCEDURE probe(outList OUT STRING_LST) IS BEGIN outList := STRING_LST(); outList.EXTEND(); outList(outList.LAST) := 'ONE'; outList.EXTEND(); outList(outList.LAST) := 'TWO'; outList.EXTEND(); outList(outList.LAST) := 'THREE'; END probe; I have ...

61. how to show alerts in table    coderanch.com

63. Create table backup .............    coderanch.com

Hi Guys, I want to take back up of a table for ex: table1 I am using PostgreSQL as my dbase. Wht I am doing is I am using pg_dump.exe utility to take backup and I am taking back up into some files ex: filetable1.backup I am using select * into temp_tbl from table1 Now after this I am executing pg_dump.exe ...

64. Getting all the Tables from schema    coderanch.com

65. populating drop down list from database table    coderanch.com

hi i have following questions: 1) How can we populate a drop down list from a database table? My drop down list should contain all the section numbers that satisfy a particular condition. I have written a query that would fetch all the correct section numbers. Now I want to add them into a drop down menu. Can someone tell me ...

66. table or view does not exist    coderanch.com

Hey pals, Please let me know, How do i check from java that if a table exists in oracle it must not create a new one else create a new one. when i gave select count of *from tablename; it said no of rows = some int. i checked a table is there but when table is not there it gave ...

67. How to store answer available in option form in database table?    coderanch.com

Hello Rancher, I have one jsp page containing 2o questions retrieved from table along with its possible four-option answer in this manner: Question1: Option-a Option-b Option-c Optio-dAll the options are in radio button form. I am trying to store the result of these question test in my final output table: Structure of this table is: Eventide -> int(2)->data from another event ...

68. get max(id) from table    coderanch.com

69. How to obtain a database table size?    coderanch.com

Hi, I'm not sure what to look for, so any pointers appreciated. So far I've succeeded to connect to a MySQL database and insert data inside. What I'm trying to do next is to the verify that the new data actually made it to the DB, and then remove the old data from the DB. I think I can do this ...

70. multiple thread polling the table    coderanch.com

Hi all, I have 12 threads polling one database table. When the program is actively running, the response is very slow in Query Analyzer for a select statement querying the same table. Anybody know what is the cause of that ? and any ways to prevent this ? Am I updating the database table too frequently and eat up all the ...

71. Check Table's Relationships    coderanch.com

I think this is a simple question, but how do i check which table a foreign key refers to in mysql? If i use describe tablename then i can see there is a key, but not sure what its refering to. I just want to verify i correctly mapped this in hibernate. mysql> describe attendedlistent_userent; +--------------------+------------+------+-----+---------+-------+ | Field | Type | ...

73. constructing an html table from db output in a particular order    coderanch.com

Hello, I am trying to construct a table of wheels but cant seem to get them to lay out properly. There are a bunch of wheels that come back in the ResultSet but when put in the table come back all in one big row. I would like to make it so that I can break up the results to make ...

74. populating drop down list from database table    coderanch.com

hi i have following questions: 1) How can we populate a drop down list from a database table? My drop down list should contain all the section numbers that satisfy a particular condition. I have written a query that would fetch all the correct section numbers. Now I want to add them into a drop down menu. Can someone tell me ...

75. creating a database table    coderanch.com

through a java program i am creating a database table like in this way .can anyone tell me a better option ? I also have to make have to make few other table like this and I have to make cascade data insertion-deletion property . how to do that? anyone with a live example please private Table createTable() { //Create the ...

76. Enum representing DB table.    coderanch.com

public enum CarManufacturerTableEnum{ VOLVO(1), JEEP(2), FORD(3), ETC(4); int manufacturerCode; CarManufacturerTableEnum(int i){manufacturerCode=i;} public int getManufacturerCode(){return manufacturerCode;} static{ String query = "SELECT * FROM CAR_MANUFACTURER" //... List lst = query.result(); if(lst.size() != this.values().size){sout("Error! table and Enum not the same size")} for(this.values()) //getItem from the list and check if its the same String and int ordinal } } } }

77. Java Objects -> Database Tables    coderanch.com

Hi Everyone - hope your all well. Ive been working on the classes for an asset/license tracking application. Keeping it quite simple, an asset object can have references to three license objects. I fancied getting this information into a database so looked into JDBC etc. Ive got to the stage where I can connect to the DB, enter the asset details ...

78. What's the java equivalent of database rate tables?    coderanch.com

Hi, I'm very much a beginner! I am a developer familiar with using database tables to store rates. The rate lookup depends on a number of variables. How would you do a similar sort of thing in Java? I'm just doing a startup java vourse and so far the only thing I can think of to do is to use a ...

79. How to prevent a user from dropping tables    coderanch.com

Hello fellow ranchers I need some information on how to grant/revoke privileges on mysql database. Basically I want to create a user and grant him select,insert and update permissions on the database. This is the user with which I'm connecting from my web app to perform operations. So I connect as root and create the database discountweb - then I'm using ...

80. ALTER TABLE - regarding    coderanch.com

I get the below exception during ALTER TABLE statement SQL0109N ALTER TABLE "<>" specified attributes for column "" that are not compatible with the existing column. SQLSTATE=42837. I tried a google and didnt get any useful information - or perhaps i was unable to interpret the information suitably. Any reason why this exception occurs during the ALTER table statement. Datatbase: DB2 ...

81. displaying all the tables from a database    coderanch.com

Hi,thank you all for your replies. I need to retrieve all the datas in a field in a single combobox.I tried the following .But It displays every combobox for every data because of using while(rs.next()) try { Class.forName ("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/peopletech", "meetme", "meetme"); st = conn.createStatement(); rs=st.executeQuery("select * from tables"); while(rs.next()) { String campaign=rs.getString("campaign"); out.print("

82. How to Store Vector in a table?    coderanch.com

84. DBVisualizer: drop and recreate table    coderanch.com

85. Table doesn't exist! but it exist!    coderanch.com

Hello, I hope this time I get some answers for this very ambiguise point about "Network Derby Server". I have created the Database through the command line, and created a table named 'CLIENTINFOR' in that database. However, when my java code tries to connect to this table is throws and SQLException saying that: table/view 'CLIENTINFOR' doesn't exist! How it says that ...

86. How to create a DB table from legacy Java code?    coderanch.com

I was handed a legacy Java application's source code that does some DB operations. However, I did not get the DB tables/structures/SQL scripts. I know which Java file contains the fields that map to fields in the DB. It's just a class with member variables like so: public class DBRecord { public String A; public int B; public Date C; ... ...

87. doubt regarding jdbc syntax error while creating a table    coderanch.com

hi.. i am using mysql 5.1.3 version.. when i try to create a table it is giving the following error..please help.. create table EVENTS (EVENT_ID bigint generated by default as identity (start with 1), EVENT_DATE timestamp, title varchar(255), primary key (EVENT_ID)) the error is you have an error in your SQL syntax; check the manual that corresponds to your MySQL server ...

88. Property Files Vs Database table    coderanch.com

A property file seems fine if, and only if, ... - its contents are cached in memory (in other words, no file access for each request) - you can live with each update to the file necessitating a web app restart - whoever has to maintain the information is fine with editing such a file If either of these is not ...

89. How to create a tables having One to One relation ship to each other    coderanch.com

You are mistaken. A one-to-one relationship implies a situation where A --> B and B --> A. Such an example might include social security numbers and e-mail addresses since having one tends to give you the other. In general, one-to-one relationships across tables aren't that common in a database. What's more common is what your describing, which is one-to-many relationship. An ...

91. How to achieve One to One mapping between two tables    coderanch.com

Hi I have taken two tables Car and Registration I want to have One to One mapping between these two tables such that each car can have only One Registration . so i had made Unique On the fORIGN KEY . Is this way correct to achive One to One on the mapping . create table Car ( CarName Varchar2(20) primary ...

93. OUT as Table in StoreProcedure    coderanch.com

94. JavaDb creating table error    coderanch.com

95. I tried debug failing: trying to incle xml file contents to db table    coderanch.com

I tried debug failing: trying to incle xml file contents to db table... xmlPlantToDB.java:170 public void endElement(String namespaceURI, String sName, String qName) throws SAXException { if (state == 1) // here error does not go to endDocument( ) searchonHand[j-1]=str; if (state == 2) searchname[j-1]=str; // line 170 xmlPlantToDB.java:47 parser.parse(new File(xmlFile), eventHandler); // line 47 Carnationjava.lang.NullPointerException at xmlPlantToDB.endElement(xmlPlantToDB.java:170) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774) ...

96. Hashtable in memory versus database table in memory    coderanch.com

I want to create a table in a database. The table should have a key and a value. The table should have entries around 100million but each row is just a 10 digit key and a 7 digit value corresponding to it. I want to load the database in memory. Instead of using a database table, I have been asked to ...

97. creating backup tables    coderanch.com

98. is this table is not good or not normalize    coderanch.com

i need to make a tabel in database using these collums(Zonetype zone peak offpeak cash). I make a one table using these things .anyway i understood this table is not correct. because i can't show number of tickects available for each types of zones? I mean it is not normalize or any other error. actually you may be can't understand what ...

99. JDBC Stored Procs and Temp tables    coderanch.com

Hi Nags, Welcome to JavaRanch. Using temp table is always tricky with Java. Temporary table in oracle is always bound to user's connection. remember the connection i am referring to is the physical connection with your oracle server, if your environment is using connection pooling then you can not be certain if you will get the results because if it is ...

100. assighn table id    coderanch.com