Alexander Selling

Greenhorn
+ Follow
since Apr 27, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alexander Selling

Paul Clapham wrote:You say you get an empty ResultSet... but you would get the identical output from that code if an Exception were thrown, namely no output. You haven't eliminated that possibility, you've just completely ignored it. Replace line 35 in your original post by this:



I changed to jtds and it started working, I've also changed a chunk of other code so.. I really don't know what made it work.. I can't wait to actually take some courses in software engineering cause I'm obviously not the type that can learn how to develop software well on my own.. The downside of just reading math and physics the first year of college I guess..

Either way I just wanted to say thank you for your time :)

Jan Cumps wrote:Can you check the type of the key column in SQLServer. Maybe when importing it from Access, the type is no longer numeric.

What happens if you query: from table where KEY1 = '16775342' ?



Things are just getting crazier for every test I do .. I have these larger SQL-statements that give me a resultset where as the simple select statement doesn't .....................

I'll try to explain, this larger statement basically:
1) fetches all the objects that belong to "today" and creates a temporary table and fills it with these objects.
2) the statement now fetches all the objects that belong to "me"(userID) out of this temporary table
3) now when we have all the objects that belong to me and the current date the statement will create new temporary tables for information about the attending entrepreneurs, insurance details, address etc, fetches the needed info and fills these temp tables.
4) to produce a resultset from these temp tables a simple select statement is made on each of them
5) drop all the temp tables

Now this larger sql statement doesn't give me any objects for today, even though management studio will, however it will give me objects for tomorrow..and the day after ..
Whereas the simple select statement I showed earlier won't give me anything, for any day ......

And you might be on to something about the type changing .. since both:
select * from table where KEY1 = '16775342'
select * from table where KEY1 = 16775342

works just fine in management studio, and makes no difference from java either. And when I look at the type in management studio
it says Key1(PK,int, not null) so it's supposed to be an integer, I don't understand why management studio nor java are complaining..
it sure does complain when I forget the '' for the Data field which is a (nvarchar(255),null)..

Where can I find an easy tutorial about the "sql server profiling tool" since I've never used it.

Paul Sturrock wrote:SQL Server Management studio auto commits by default. If you are not sure what "commit" means in a database context I would recommend you stop coding and take a bit of time to read up on database concepts. Life will be far less painful if you do.

It might be an idea to use the SQL Server profiling tool to make sure you are running the SQL you believe you are. It could be you are using different schemas or your statement is subtly different.

As another aside, this:

kind of defeats one of the purposes of JDBC. You might want to change that call to use a String read from somewhere.



I don't know what purpose it defeats but after some googling.. I've changed the connection call. I know what commit means, it's the means of making a transaction permanent. I just didn't know what you meant with "Have you committed all the inserts that you did in SQL Server Management Studio ?" because I haven't done any inserts there I've imported the database from an MS Access database that has its input from a CRM software. So I really have no control over what goes into the database, I'm just trying to learn how to read the data that the crm software populates the database with. I obviously should have told you that.. so that's my bad.

It's been working for quite some time now though and for some reason it just stopped working...

Jan Cumps wrote:... and please don't change your original first post. Other people will now not understand what we were talking about.



Alright, edited it again.

Jan Cumps wrote:Have you committed all the inserts that you did in SQL Server Management Studio ?



I'm afraid I don't know what you mean, the rows have been in the database for at least a week and the problem will persist no matter if I restart the server or not.
The only "commit" I know of is the one in java where you basically execute the changes you've made through an 'update' or the like.

As far as I can understand the data I'm asking the database for is committed since it's there after I've restarted both the sql server and the windows 2003 server.

Jan Cumps wrote:What happens if you use:
rset = st.executeQuery(query);

And it's better not to use "SELECT *". Use the SELECT real column names".



I've changed the code accordingly. I've also changed the select statement to only retrieve one column.
The resultset is still empty though, I can add that it works about 50-60% of the time and I'm trying to figure out why java ignores some rows in the database
where as it gladly accepts others ...

Just to be clear, when I execute these statements, depending on what ID I'm looking for java will either give me a resultset or it won't.
Where as the SQL Server Management Studio ALWAYS gives me a resultset ..
Hey guys!

Background info:
The database is a Microsoft SQL Server 2008
The java program is running on a Windows 2003 Server 64 bit
I'm using the latest verison of java off of oracles site

My problem is that I'm not getting a resultset when executing a SQL-statement, I really just can't figure out why.

Executing this string in the Microsoft SQL Server Management Studio gives the wanted resultset:
SELECT * FROM Database.dbo.Table WHERE KEY1 = 16775342;

However doing the exact same thing in java gives me an empty resultset ....


Hey guys!

I was wondering how I would go about keeping tracking of the potential users in my web shop ?
I mean I know I can force them to log in, but then what ? What do I use to tie that user to his "account". And besides most web shops don't require you to log in :/

I've searched this forum and some on google but I guess I'm using the wrong search strings

Thanks in advance

11 years ago
JSP

Have you tried something similar with a non-delimited column name?



Thing is I'm using an MSAccess database that came with a product that the family company bought, so I can't change their column names. However I imported their database into my MSSQL server and changed the column names on my copy of it, and just like you said, it will retrieve less results every time due to the space in the column name, because when I changed it from [KEY 1] to just KEY1, suddenly all the results came just fine. Now I don't know how to solve this, since I can't change the actual database that I want to read from, but at least now I know why

Thanks a lot!
I don't really know how to describe the output, I'm getting 26 rows of results from the MSSQL manager and only 16 rows from java, I guess I was more asking if you guys had ever experienced anything like it ?
Since it is a very simple query merely a select statement, how could there be a difference ?
I'll give you some more (smaller) screenshots if you'd like ?

Tom Reilly wrote:Before you edited your post, you had two different select statements. One had "where key=XXXX" and the other had "where key=YYYY"



Yeah I noticed that, I just took the picture earlier and happened to paste that one, it is the exact same query though.
I just took the screenshots cause I thought it would make things clearer, seeing how the MSSQL manager gets more results even though the sql syntax is exactly the same.

Hey guys!

I really have no clue what's going on at all.. I've noticed lately how sometimes I won't get as many results from a query in Java as I get from doing the exact same SQL query from within the MSSQL Server Management Studio.
I've tried to include the MSSQL manager output and the java output, with the output data omitted. And my class that connects to the database is also pasted in there.
Basically the same query retrieves 26 results from within the MSSQL manager and only 16 from java ?!
Please point me in the right direction here

Thanks in advance !

Edited to remove screenshot: please post text.
Okay so in case someone else decides to use JExcel(JXL), all you need to do is to convert from 8859_1 to default java like this:
String isoEncoding = new String(cell.getContens().getBytes(),"8859_1");
11 years ago
I'm using the JExcel API to read an excel file but it doesn't seem to support international characters such as åäö(swedish).

And so my question is how can I convert the current encoding into something that supports swedish ? I read the JExcel API documentation and it says it's supposed to be Unicode by default, I've tried using unicode to utf8 and vice versa conversion methods but it doesn't make any difference.

For example "SÄB" is display as "SƒB".

Thanks in advance!





11 years ago

Christophe Verré wrote:What about the returned value of getQuery ? Is it ok ? Isn't getQuery returning you too many results ?



Thanks a bunch, I never cleared the arraylist that the class Query fills the "queries" with. Now it's all working.

Darryl Burke wrote:updateUI() isn't the correct method to invoke after adding/removing components from a visible container. Use revalidate() and repaint() instead.



I've changed now, but what is the difference ?
12 years ago