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 ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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
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? ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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.
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 ...
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?
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, ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 | ...
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 ...
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 ...
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 ...
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 } } } }
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 ...
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 ...
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 ...
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 ...
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("
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 ...
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; ... ...
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 ...
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 ...
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 ...
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 ...
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) ...
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 ...
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 ...
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 ...